mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
we now have two types of namespaces: - true namespace: angular.* - used for all global apis - virtual namespace: ng.*, ngMock.*, ... - used for all DI modules the virual namespaces have services under the second namespace level (e.g. ng.) and filters and directives prefixed with filter: and directive: respectively (e.g. ng.filter:orderBy, ng.directive:ngRepeat) this simplifies urls and makes them a lot shorter while still avoiding name collisions
28 lines
854 B
JavaScript
28 lines
854 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* @ngdoc object
|
|
* @name ng.$window
|
|
*
|
|
* @description
|
|
* A reference to the browser's `window` object. While `window`
|
|
* is globally available in JavaScript, it causes testability problems, because
|
|
* it is a global variable. In angular we always refer to it through the
|
|
* `$window` service, so it may be overriden, removed or mocked for testing.
|
|
*
|
|
* All expressions are evaluated with respect to current scope so they don't
|
|
* suffer from window globality.
|
|
*
|
|
* @example
|
|
<doc:example>
|
|
<doc:source>
|
|
<input ng-init="$window = $service('$window'); greeting='Hello World!'" type="text" ng-model="greeting" />
|
|
<button ng-click="$window.alert(greeting)">ALERT</button>
|
|
</doc:source>
|
|
<doc:scenario>
|
|
</doc:scenario>
|
|
</doc:example>
|
|
*/
|
|
function $WindowProvider(){
|
|
this.$get = valueFn(window);
|
|
}
|