angular/angular.js — pull request #10334 by jhoguet (2014-12-05 06:00:42+00:00)
Title: using $window.angular so that we can put angular in no-conflict mode

we need to support multiple instances of angular on our page to support an enterprise rollout, where our instance is effectively 3rd party js. To do this we end up setting `$window.angular` to our instance of angular, but `window.angular` is undefined or their instance of angular if they have one. This will throw for us if they don't have their own instance of angular (`window.angular` is undefined.)

In case you're wondering... we are also hijacking `$window` so that when we set `$window.angular` it doesn't set `window.angular`

```javascript
.service('$window', function(){
// angular isn't actually wrapping window - so if you set something it is available on window
// this probably has side effects :(
var $window = Object.create(window);

// angular has some references to itself through window (search for $window.angular.callbacks)
// we want it to use ours not the "real" one if there is another one later...
$window.angular = angular;

// this is sacrificing JSONP with $http but that is ok with us
return $window;
})
```