forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.service.$location.html
95 lines (95 loc) · 3.12 KB
/
angular.service.$location.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<h1>angular.service.$location</h1>
<div class="angular-service-location"><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>
<div class="description"><p>Parses the browser location url and makes it available to your application.
Any changes to the url are reflected into $location service and changes to
$location are reflected to url.
Notice that using browser's forward/back buttons changes the $location.</p></div>
<h2>Dependencies</h2>
<ul class="dependencies"><li>$browser</li>
</ul>
<h2>Methods</h2>
<ul class="methods"><li><h3>update(href)</h3>
<div class="update-href-"><p>Update location object
Does not immediately update the browser
Browser is updated at the end of $eval()</p><h4>Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">href – {(string|Object)} – </code>
<p>Full href as a string or object with properties</p></li>
</ul>
<h4>Example</h4>
<div class="example"><doc:example>
<doc:source>
scope.$location.update('http://www.angularjs.org/path#hash?search=x');
scope.$location.update({host: 'www.google.com', protocol: 'https'});
scope.$location.update({hashPath: '/path', hashSearch: {a: 'b', x: true}});
</doc:source>
<doc:scenario>
</doc:scenario>
</doc:example></div>
</div>
</li>
<li><h3>updateHash(path, search)</h3>
<div class="updatehash-path-search-"><p>Update location hash part</p><h4>Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">path – {(string|Object)} – </code>
<p>A hashPath or hashSearch object</p></li>
<li><code ng:non-bindable="">search<i>(optional)</i> – {Object} – </code>
<p>A hashSearch object</p></li>
</ul>
<h4>Example</h4>
<div class="example"><doc:example>
<doc:source>
scope.$location.updateHash('/hp')
==> update({hashPath: '/hp'})
scope.$location.updateHash({a: true, b: 'val'})
==> update({hashSearch: {a: true, b: 'val'}})
scope.$location.updateHash('/hp', {a: true})
==> update({hashPath: '/hp', hashSearch: {a: true}})
</doc:source>
<doc:scenario>
</doc:scenario>
</doc:example></div>
</div>
</li>
</ul>
<h2>Properties</h2>
<ul class="properties"><li><h3>href</h3>
<div class="href"><p>undefined</p></div>
</li>
<li><h3>protocol</h3>
<div class="protocol"><p>undefined</p></div>
</li>
<li><h3>host</h3>
<div class="host"><p>undefined</p></div>
</li>
<li><h3>port</h3>
<div class="port"><p>undefined</p></div>
</li>
<li><h3>path</h3>
<div class="path"><p>undefined</p></div>
</li>
<li><h3>search</h3>
<div class="search"><p>undefined</p></div>
</li>
<li><h3>hash</h3>
<div class="hash"><p>undefined</p></div>
</li>
<li><h3>hashPath</h3>
<div class="hashpath"><p>undefined</p></div>
</li>
<li><h3>hashSearch</h3>
<div class="hashsearch"><p>undefined</p></div>
</li>
</ul>
<h2>Example</h2>
<div class="example"><doc:example>
<doc:source>
<a href="#">clear hash</a> |
<a href="#myPath?name=misko">test hash</a><br/>
<input type='text' name="$location.hash"/>
<pre>$location = {{$location}}</pre>
</doc:source>
<doc:scenario>
</doc:scenario>
</doc:example></div>
</div>