forked from mmistakes/minimal-mistakes
/
_url_urlservice_.urlservice.html
603 lines (600 loc) · 31.9 KB
/
_url_urlservice_.urlservice.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
---
---
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>UrlService | @uirouter/core</title>
<meta name="description" content="Documentation for @uirouter/core">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">@uirouter/core</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../index.html">@uirouter/core</a>
</li>
<li>
<a href="../modules/_url_urlservice_.html">"url/urlService"</a>
</li>
<li>
<a href="_url_urlservice_.urlservice.html">UrlService</a>
</li>
</ul>
<h1>Class UrlService</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>API for URL management</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">UrlService</span>
</li>
</ul>
</section>
<section class="tsd-panel">
<h3>Implements</h3>
<ul class="tsd-hierarchy">
<li><a href="../interfaces/_common_coreservices_.locationservices.html" class="tsd-signature-type">LocationServices</a></li>
<li><a href="../interfaces/_url_interface_.urlsyncapi.html" class="tsd-signature-type">UrlSyncApi</a></li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section tsd-is-external">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#config" class="tsd-kind-icon">config</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#rules" class="tsd-kind-icon">rules</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-external">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#deferintercept" class="tsd-kind-icon">defer<wbr>Intercept</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#hash" class="tsd-kind-icon">hash</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#listen" class="tsd-kind-icon">listen</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#match" class="tsd-kind-icon">match</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#parts" class="tsd-kind-icon">parts</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#path" class="tsd-kind-icon">path</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#search" class="tsd-kind-icon">search</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#sync" class="tsd-kind-icon">sync</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="_url_urlservice_.urlservice.html#url" class="tsd-kind-icon">url</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="config" class="tsd-anchor"></a>
<h3>config</h3>
<div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <a href="_url_urlconfig_.urlconfig.html" class="tsd-signature-type">UrlConfig</a><span class="tsd-signature-symbol"> = new UrlConfig(this.router)</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L27">src/url/urlService.ts:27</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The nested <a href="_url_urlconfig_.urlconfig.html">UrlConfig</a> API to configure the URL and retrieve URL information</p>
</div>
<p>See: <a href="_url_urlconfig_.urlconfig.html">UrlConfig</a> for details</p>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="rules" class="tsd-anchor"></a>
<h3>rules</h3>
<div class="tsd-signature tsd-kind-icon">rules<span class="tsd-signature-symbol">:</span> <a href="_url_urlrules_.urlrules.html" class="tsd-signature-type">UrlRules</a><span class="tsd-signature-symbol"> = new UrlRules(this.router)</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L20">src/url/urlService.ts:20</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The nested <a href="_url_urlrules_.urlrules.html">UrlRules</a> API for managing URL rules and rewrites</p>
</div>
<p>See: <a href="_url_urlrules_.urlrules.html">UrlRules</a> for details</p>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="deferintercept" class="tsd-anchor"></a>
<h3>defer<wbr>Intercept</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">defer<wbr>Intercept<span class="tsd-signature-symbol">(</span>defer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L138">src/url/urlService.ts:138</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Disables monitoring of the URL.</p>
</div>
<p>Call this method before UI-Router has bootstrapped.
It will stop UI-Router from performing the initial url sync.</p>
<p>This can be useful to perform some asynchronous initialization before the router starts.
Once the initialization is complete, call <a href="_url_urlservice_.urlservice.html#listen">listen</a> to tell UI-Router to start watching and synchronizing the URL.</p>
<a href="#example" id="example" style="color: inherit; text-decoration: none;">
<h4>Example:</h4>
</a>
<pre><code class="language-js"><span class="hljs-comment">// Prevent UI-Router from automatically intercepting URL changes when it starts;</span>
urlService.deferIntercept();
fetch(<span class="hljs-string">'/states.json'</span>).then(<span class="hljs-function"><span class="hljs-params">resp</span> =></span> resp.json()).then(<span class="hljs-function"><span class="hljs-params">data</span> =></span> {
data.forEach(<span class="hljs-function"><span class="hljs-params">state</span> =></span> $stateRegistry.register(state));
urlService.listen();
urlService.sync();
});</code></pre>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> defer: <span class="tsd-signature-type">boolean</span></h5>
<div class="tsd-comment tsd-typography">
<p>Indicates whether to defer location change interception.
Passing no parameter is equivalent to <code>true</code>.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="hash" class="tsd-anchor"></a>
<h3>hash</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">hash<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L257">src/url/urlService.ts:257</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Gets the hash part of the current url</p>
</div>
<p>If the current URL is <code>/some/path?query=value#anchor</code>, this returns <code>anchor</code></p>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<p>the hash (anchor) portion of the url</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="listen" class="tsd-anchor"></a>
<h3>listen</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">listen<span class="tsd-signature-symbol">(</span>enabled<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Function</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L104">src/url/urlService.ts:104</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Starts or stops listening for URL changes</p>
</div>
<p>Call this sometime after calling <a href="_url_urlservice_.urlservice.html#deferintercept">deferIntercept</a> to start monitoring the url.
This causes UI-Router to start listening for changes to the URL, if it wasn't already listening.</p>
<p>If called with <code>false</code>, UI-Router will stop listening (call listen(true) to start listening again).</p>
<a href="#example" id="example" style="color: inherit; text-decoration: none;">
<h4>Example:</h4>
</a>
<pre><code class="language-js">urlService.deferIntercept();
fetch(<span class="hljs-string">'/states.json'</span>).then(<span class="hljs-function"><span class="hljs-params">resp</span> =></span> resp.json()).then(<span class="hljs-function"><span class="hljs-params">data</span> =></span> {
data.forEach(<span class="hljs-function"><span class="hljs-params">state</span> =></span> $stateRegistry.register(state));
<span class="hljs-comment">// Start responding to URL changes</span>
urlService.listen();
urlService.sync();
});</code></pre>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> enabled: <span class="tsd-signature-type">boolean</span></h5>
<div class="tsd-comment tsd-typography">
<p><code>true</code> or <code>false</code> to start or stop listening to URL changes</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="match" class="tsd-anchor"></a>
<h3>match</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">match<span class="tsd-signature-symbol">(</span>url<span class="tsd-signature-symbol">: </span><a href="../interfaces/_url_interface_.urlparts.html" class="tsd-signature-type">UrlParts</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_url_interface_.matchresult.html" class="tsd-signature-type">MatchResult</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L149">src/url/urlService.ts:149</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Matches a URL</p>
</div>
<p>Given a URL (as a <a href="../interfaces/_url_interface_.urlparts.html">UrlParts</a> object), check all rules and determine the best matching rule.
Return the result as a <a href="../interfaces/_url_interface_.matchresult.html">MatchResult</a>.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>url: <a href="../interfaces/_url_interface_.urlparts.html" class="tsd-signature-type">UrlParts</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="../interfaces/_url_interface_.matchresult.html" class="tsd-signature-type">MatchResult</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="parts" class="tsd-anchor"></a>
<h3>parts</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">parts<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_url_interface_.urlparts.html" class="tsd-signature-type">UrlParts</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L42">src/url/urlService.ts:42</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Gets the current URL parts</p>
</div>
<p>This method returns the different parts of the current URL (the <a href="_url_urlservice_.urlservice.html#path">path</a>, <a href="_url_urlservice_.urlservice.html#search">search</a>, and <a href="_url_urlservice_.urlservice.html#hash">hash</a>) as a <a href="../interfaces/_url_interface_.urlparts.html">UrlParts</a> object.</p>
</div>
<h4 class="tsd-returns-title">Returns <a href="../interfaces/_url_interface_.urlparts.html" class="tsd-signature-type">UrlParts</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="path" class="tsd-anchor"></a>
<h3>path</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">path<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L239">src/url/urlService.ts:239</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Gets the path part of the current url</p>
</div>
<p>If the current URL is <code>/some/path?query=value#anchor</code>, this returns <code>/some/path</code></p>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<p>the path portion of the url</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="search" class="tsd-anchor"></a>
<h3>search</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">search<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{}</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L248">src/url/urlService.ts:248</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Gets the search part of the current url as an object</p>
</div>
<p>If the current URL is <code>/some/path?query=value#anchor</code>, this returns <code>{ query: 'value' }</code></p>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{}</span></h4>
<p>the search (query) portion of the url, as an object</p>
<ul class="tsd-parameters">
<li class="tsd-parameter-index-signature">
<h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="sync" class="tsd-anchor"></a>
<h3>sync</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">sync<span class="tsd-signature-symbol">(</span>evt<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L66">src/url/urlService.ts:66</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Activates the best rule for the current URL</p>
</div>
<p>Checks the current URL for a matching <a href="../interfaces/_url_interface_.urlrule.html">UrlRule</a>, then invokes that rule's handler.
This method is called internally any time the URL has changed.</p>
<p>This effectively activates the state (or redirect, etc) which matches the current URL.</p>
<a href="#example" id="example" style="color: inherit; text-decoration: none;">
<h4>Example:</h4>
</a>
<pre><code class="language-js">urlService.deferIntercept();
fetch(<span class="hljs-string">'/states.json'</span>).then(<span class="hljs-function"><span class="hljs-params">resp</span> =></span> resp.json()).then(<span class="hljs-function"><span class="hljs-params">data</span> =></span> {
data.forEach(<span class="hljs-function"><span class="hljs-params">state</span> =></span> $stateRegistry.register(state));
urlService.listen();
<span class="hljs-comment">// Find the matching URL and invoke the handler.</span>
urlService.sync();
});</code></pre>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> evt: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a name="url" class="tsd-anchor"></a>
<h3>url</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
<li class="tsd-signature tsd-kind-icon">url<span class="tsd-signature-symbol">(</span>newurl<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, replace<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, state<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/core/blob/9286151/src/url/urlService.ts#L229">src/url/urlService.ts:229</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Gets the current url, or updates the url</p>
</div>
<a href="#getting-the-current-url" id="getting-the-current-url" style="color: inherit; text-decoration: none;">
<h3>Getting the current URL</h3>
</a>
<p>When no arguments are passed, returns the current URL.
The URL is normalized using the internal <a href="_url_urlservice_.urlservice.html#path">path</a>/<a href="_url_urlservice_.urlservice.html#search">search</a>/<a href="_url_urlservice_.urlservice.html#hash">hash</a> values.</p>
<p>For example, the URL may be stored in the hash ([[HashLocationServices]]) or
have a base HREF prepended ([[PushStateLocationServices]]).</p>
<p>The raw URL in the browser might be:</p>
<pre><code>http:<span class="hljs-regexp">//my</span>site.com<span class="hljs-regexp">/somepath/i</span>ndex.html<span class="hljs-comment">#/internal/path/123?param1=foo#anchor</span></code></pre><p>or</p>
<pre><code>http:<span class="hljs-regexp">//my</span>site.com<span class="hljs-regexp">/basepath/i</span>nternal<span class="hljs-regexp">/path/</span><span class="hljs-number">123</span>?param1=foo<span class="hljs-comment">#anchor</span></code></pre><p>then this method returns:</p>
<pre><code><span class="hljs-regexp">/internal/</span>path/<span class="hljs-number">123</span>?param1=foo<span class="hljs-comment">#anchor</span></code></pre>
<a href="#example" id="example" style="color: inherit; text-decoration: none;">
<h4>Example:</h4>
</a>
<pre><code class="language-js">locationServices.url(); <span class="hljs-comment">// "/some/path?query=value#anchor"</span></code></pre>
<a href="#updating-the-url" id="updating-the-url" style="color: inherit; text-decoration: none;">
<h3>Updating the URL</h3>
</a>
<p>When <code>newurl</code> arguments is provided, changes the URL to reflect <code>newurl</code></p>
<a href="#example-1" id="example-1" style="color: inherit; text-decoration: none;">
<h4>Example:</h4>
</a>
<pre><code class="language-js">locationServices.url(<span class="hljs-string">"/some/path?query=value#anchor"</span>, <span class="hljs-literal">true</span>);</code></pre>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> newurl: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The new value for the URL.
This url should reflect only the new internal <a href="_url_urlservice_.urlservice.html#path">path</a>, <a href="_url_urlservice_.urlservice.html#search">search</a>, and <a href="_url_urlservice_.urlservice.html#hash">hash</a> values.
It should not include the protocol, site, port, or base path of an absolute HREF.</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> replace: <span class="tsd-signature-type">boolean</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>When true, replaces the current history entry (instead of appending it) with this new url</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> state: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The history's state object, i.e., pushState (if the LocationServices implementation supports it)</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<p>the url (after potentially being processed)</p>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="label ">
<span></span>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_router_.uirouter.html">UIRouter</a>
</li>
<li class="label ">
<span>Services</span>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_state_stateservice_.stateservice.html">State<wbr>Service</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_state_stateregistry_.stateregistry.html">State<wbr>Registry</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_transition_transitionservice_.transitionservice.html">Transition<wbr>Service</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_url_urlservice_.urlservice.html">Url<wbr>Service</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_url_urlconfig_.urlconfig.html">Url<wbr>Config</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_url_urlrules_.urlrules.html">Url<wbr>Rules</a>
</li>
<li class="label ">
<span>Other</span>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_transition_transition_.transition.html">Transition</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_common_trace_.trace.html">Trace</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="_url_urlservice_.urlservice.html" class="tsd-kind-icon">Url<wbr>Service</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#config" class="tsd-kind-icon">config</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#rules" class="tsd-kind-icon">rules</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#deferintercept" class="tsd-kind-icon">defer<wbr>Intercept</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#hash" class="tsd-kind-icon">hash</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#listen" class="tsd-kind-icon">listen</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#match" class="tsd-kind-icon">match</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#parts" class="tsd-kind-icon">parts</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#path" class="tsd-kind-icon">path</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#search" class="tsd-kind-icon">search</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#sync" class="tsd-kind-icon">sync</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
<a href="_url_urlservice_.urlservice.html#url" class="tsd-kind-icon">url</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>