aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/window.js
diff options
context:
space:
mode:
authorMisko Hevery2012-03-23 14:03:24 -0700
committerMisko Hevery2012-03-28 11:16:35 -0700
commit2430f52bb97fa9d682e5f028c977c5bf94c5ec38 (patch)
treee7529b741d70199f36d52090b430510bad07f233 /src/ng/window.js
parent944098a4e0f753f06b40c73ca3e79991cec6c2e2 (diff)
downloadangular.js-2430f52bb97fa9d682e5f028c977c5bf94c5ec38.tar.bz2
chore(module): move files around in preparation for more modules
Diffstat (limited to 'src/ng/window.js')
-rw-r--r--src/ng/window.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ng/window.js b/src/ng/window.js
new file mode 100644
index 00000000..d7adea03
--- /dev/null
+++ b/src/ng/window.js
@@ -0,0 +1,28 @@
+'use strict';
+
+/**
+ * @ngdoc object
+ * @name angular.module.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);
+}