forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.service.$window.html
30 lines (28 loc) · 1001 Bytes
/
angular.service.$window.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<h1><tt>angular.service.$window</tt></h1>
<fieldset class="workInProgress">
<legend>Work In Progress</legend>
This page is currently being revised. It might be incomplete or contain inaccuracies.
</fieldset>
<h2>Description</h2>
<p>Is reference to the browser's <b>window</b> object. While <b>window</b>
is globally available in JavaScript, it causes testability problems, because
it is a global variable. In <b><tt><angular/></tt></b> we always refer to it through the
$window service, so it may be overriden, removed or mocked for testing.</p>
<p>All expressions are evaluated with respect to current scope so they don't
suffer from window globality.</p>
<h2>Dependencies</h2>
<ul>
</ul>
<h2>Methods</h2>
<ul>
</ul>
<h2>Properties</h2>
<ul>
</ul>
<h2>Example</h2>
<doc:example>
<doc:source>
<input ng:init="greeting='Hello World!'" type="text" name="greeting" />
<button ng:click="$window.alert(greeting)">ALERT</button>
</doc:source>
</doc:example>