@angular/router 7.2.0-beta.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/bundles/router-testing.umd.js +1 -1
  2. package/bundles/router-testing.umd.js.map +1 -1
  3. package/bundles/router-testing.umd.min.js +1 -1
  4. package/bundles/router-testing.umd.min.js.map +1 -1
  5. package/bundles/router-upgrade.umd.js +1 -1
  6. package/bundles/router-upgrade.umd.js.map +1 -1
  7. package/bundles/router-upgrade.umd.min.js +1 -1
  8. package/bundles/router-upgrade.umd.min.js.map +1 -1
  9. package/bundles/router.umd.js +87 -18
  10. package/bundles/router.umd.js.map +1 -1
  11. package/bundles/router.umd.min.js +6 -6
  12. package/bundles/router.umd.min.js.map +1 -1
  13. package/esm2015/index.js +2 -3
  14. package/esm2015/public_api.js +2 -4
  15. package/esm2015/router.externs.js +7 -3
  16. package/esm2015/router.js +1 -2
  17. package/esm2015/src/apply_redirects.js +60 -21
  18. package/esm2015/src/components/empty_outlet.js +2 -3
  19. package/esm2015/src/config.js +40 -66
  20. package/esm2015/src/create_router_state.js +3 -4
  21. package/esm2015/src/create_url_tree.js +3 -6
  22. package/esm2015/src/directives/router_link.js +71 -13
  23. package/esm2015/src/directives/router_link_active.js +30 -10
  24. package/esm2015/src/directives/router_outlet.js +46 -15
  25. package/esm2015/src/events.js +47 -35
  26. package/esm2015/src/index.js +2 -3
  27. package/esm2015/src/interfaces.js +44 -25
  28. package/esm2015/src/operators/activate_routes.js +31 -9
  29. package/esm2015/src/operators/apply_redirects.js +2 -3
  30. package/esm2015/src/operators/check_guards.js +8 -9
  31. package/esm2015/src/operators/prioritized_guard_value.js +4 -6
  32. package/esm2015/src/operators/recognize.js +2 -3
  33. package/esm2015/src/operators/resolve_data.js +3 -4
  34. package/esm2015/src/operators/switch_tap.js +2 -3
  35. package/esm2015/src/private_export.js +2 -3
  36. package/esm2015/src/recognize.js +41 -21
  37. package/esm2015/src/route_reuse_strategy.js +2 -9
  38. package/esm2015/src/router.js +304 -199
  39. package/esm2015/src/router_config_loader.js +24 -10
  40. package/esm2015/src/router_module.js +202 -188
  41. package/esm2015/src/router_outlet_context.js +7 -4
  42. package/esm2015/src/router_preloader.js +27 -8
  43. package/esm2015/src/router_scroller.js +37 -11
  44. package/esm2015/src/router_state.js +12 -19
  45. package/esm2015/src/shared.js +42 -34
  46. package/esm2015/src/url_handling_strategy.js +2 -3
  47. package/esm2015/src/url_tree.js +31 -7
  48. package/esm2015/src/utils/collection.js +2 -3
  49. package/esm2015/src/utils/preactivation.js +10 -5
  50. package/esm2015/src/utils/tree.js +5 -3
  51. package/esm2015/src/utils/type_guards.js +2 -3
  52. package/esm2015/src/version.js +11 -6
  53. package/esm2015/testing/index.js +2 -3
  54. package/esm2015/testing/public_api.js +2 -4
  55. package/esm2015/testing/src/router_testing_module.js +9 -6
  56. package/esm2015/testing/src/testing.js +2 -3
  57. package/esm2015/testing/testing.js +1 -2
  58. package/esm2015/upgrade/index.js +2 -3
  59. package/esm2015/upgrade/public_api.js +2 -4
  60. package/esm2015/upgrade/src/upgrade.js +9 -8
  61. package/esm2015/upgrade/upgrade.js +1 -2
  62. package/esm5/index.js +1 -2
  63. package/esm5/public_api.js +1 -2
  64. package/esm5/router.js +1 -2
  65. package/esm5/src/apply_redirects.js +1 -2
  66. package/esm5/src/components/empty_outlet.js +1 -2
  67. package/esm5/src/config.js +1 -2
  68. package/esm5/src/create_router_state.js +1 -2
  69. package/esm5/src/create_url_tree.js +1 -2
  70. package/esm5/src/directives/router_link.js +31 -2
  71. package/esm5/src/directives/router_link_active.js +1 -2
  72. package/esm5/src/directives/router_outlet.js +1 -2
  73. package/esm5/src/events.js +1 -2
  74. package/esm5/src/index.js +1 -2
  75. package/esm5/src/interfaces.js +1 -2
  76. package/esm5/src/operators/activate_routes.js +1 -2
  77. package/esm5/src/operators/apply_redirects.js +1 -2
  78. package/esm5/src/operators/check_guards.js +1 -2
  79. package/esm5/src/operators/prioritized_guard_value.js +1 -2
  80. package/esm5/src/operators/recognize.js +1 -2
  81. package/esm5/src/operators/resolve_data.js +1 -2
  82. package/esm5/src/operators/switch_tap.js +1 -2
  83. package/esm5/src/private_export.js +1 -2
  84. package/esm5/src/recognize.js +1 -2
  85. package/esm5/src/route_reuse_strategy.js +1 -2
  86. package/esm5/src/router.js +50 -18
  87. package/esm5/src/router_config_loader.js +1 -2
  88. package/esm5/src/router_module.js +1 -2
  89. package/esm5/src/router_outlet_context.js +1 -2
  90. package/esm5/src/router_preloader.js +1 -2
  91. package/esm5/src/router_scroller.js +1 -2
  92. package/esm5/src/router_state.js +1 -2
  93. package/esm5/src/shared.js +1 -2
  94. package/esm5/src/url_handling_strategy.js +1 -2
  95. package/esm5/src/url_tree.js +1 -2
  96. package/esm5/src/utils/collection.js +1 -2
  97. package/esm5/src/utils/preactivation.js +7 -2
  98. package/esm5/src/utils/tree.js +1 -2
  99. package/esm5/src/utils/type_guards.js +1 -2
  100. package/esm5/src/version.js +2 -3
  101. package/esm5/testing/index.js +1 -2
  102. package/esm5/testing/public_api.js +1 -2
  103. package/esm5/testing/src/router_testing_module.js +1 -2
  104. package/esm5/testing/src/testing.js +1 -2
  105. package/esm5/testing/testing.js +1 -2
  106. package/esm5/upgrade/index.js +1 -2
  107. package/esm5/upgrade/public_api.js +1 -2
  108. package/esm5/upgrade/src/upgrade.js +1 -2
  109. package/esm5/upgrade/upgrade.js +1 -2
  110. package/fesm2015/router.js +387 -202
  111. package/fesm2015/router.js.map +1 -1
  112. package/fesm2015/testing.js +7 -8
  113. package/fesm2015/testing.js.map +1 -1
  114. package/fesm2015/upgrade.js +11 -10
  115. package/fesm2015/upgrade.js.map +1 -1
  116. package/fesm5/router.js +87 -18
  117. package/fesm5/router.js.map +1 -1
  118. package/fesm5/testing.js +1 -1
  119. package/fesm5/testing.js.map +1 -1
  120. package/fesm5/upgrade.js +1 -1
  121. package/fesm5/upgrade.js.map +1 -1
  122. package/package.json +4 -4
  123. package/router.metadata.json +1 -1
  124. package/src/config.d.ts +9 -2
  125. package/src/directives/router_link.d.ts +27 -0
  126. package/src/events.d.ts +6 -2
  127. package/src/index.d.ts +1 -1
  128. package/src/router.d.ts +74 -3
  129. package/testing.d.ts +5 -0
  130. package/upgrade.d.ts +5 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v7.2.0-beta.0
2
+ * @license Angular v7.2.0
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -12,7 +12,14 @@ import { ɵgetDOM } from '@angular/platform-browser';
12
12
 
13
13
  /**
14
14
  * @fileoverview added by tsickle
15
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
15
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
16
+ */
17
+ /**
18
+ * @license
19
+ * Copyright Google Inc. All Rights Reserved.
20
+ *
21
+ * Use of this source code is governed by an MIT-style license that can be
22
+ * found in the LICENSE file at https://angular.io/license
16
23
  */
17
24
  /**
18
25
  * \@description
@@ -60,10 +67,14 @@ class NavigationStart extends RouterEvent {
60
67
  * @param {?=} navigationTrigger
61
68
  * @param {?=} restoredState
62
69
  */
63
- constructor(/** @docsNotRequired */
64
- id, /** @docsNotRequired */
65
- url, /** @docsNotRequired */
66
- navigationTrigger = 'imperative', /** @docsNotRequired */
70
+ constructor(
71
+ /** @docsNotRequired */
72
+ id,
73
+ /** @docsNotRequired */
74
+ url,
75
+ /** @docsNotRequired */
76
+ navigationTrigger = 'imperative',
77
+ /** @docsNotRequired */
67
78
  restoredState = null) {
68
79
  super(id, url);
69
80
  this.navigationTrigger = navigationTrigger;
@@ -88,8 +99,10 @@ class NavigationEnd extends RouterEvent {
88
99
  * @param {?} url
89
100
  * @param {?} urlAfterRedirects
90
101
  */
91
- constructor(/** @docsNotRequired */
92
- id, /** @docsNotRequired */
102
+ constructor(
103
+ /** @docsNotRequired */
104
+ id,
105
+ /** @docsNotRequired */
93
106
  url, urlAfterRedirects) {
94
107
  super(id, url);
95
108
  this.urlAfterRedirects = urlAfterRedirects;
@@ -115,8 +128,10 @@ class NavigationCancel extends RouterEvent {
115
128
  * @param {?} url
116
129
  * @param {?} reason
117
130
  */
118
- constructor(/** @docsNotRequired */
119
- id, /** @docsNotRequired */
131
+ constructor(
132
+ /** @docsNotRequired */
133
+ id,
134
+ /** @docsNotRequired */
120
135
  url, reason) {
121
136
  super(id, url);
122
137
  this.reason = reason;
@@ -140,8 +155,10 @@ class NavigationError extends RouterEvent {
140
155
  * @param {?} url
141
156
  * @param {?} error
142
157
  */
143
- constructor(/** @docsNotRequired */
144
- id, /** @docsNotRequired */
158
+ constructor(
159
+ /** @docsNotRequired */
160
+ id,
161
+ /** @docsNotRequired */
145
162
  url, error) {
146
163
  super(id, url);
147
164
  this.error = error;
@@ -168,8 +185,10 @@ class RoutesRecognized extends RouterEvent {
168
185
  * @param {?} urlAfterRedirects
169
186
  * @param {?} state
170
187
  */
171
- constructor(/** @docsNotRequired */
172
- id, /** @docsNotRequired */
188
+ constructor(
189
+ /** @docsNotRequired */
190
+ id,
191
+ /** @docsNotRequired */
173
192
  url, urlAfterRedirects, state) {
174
193
  super(id, url);
175
194
  this.urlAfterRedirects = urlAfterRedirects;
@@ -197,8 +216,10 @@ class GuardsCheckStart extends RouterEvent {
197
216
  * @param {?} urlAfterRedirects
198
217
  * @param {?} state
199
218
  */
200
- constructor(/** @docsNotRequired */
201
- id, /** @docsNotRequired */
219
+ constructor(
220
+ /** @docsNotRequired */
221
+ id,
222
+ /** @docsNotRequired */
202
223
  url, urlAfterRedirects, state) {
203
224
  super(id, url);
204
225
  this.urlAfterRedirects = urlAfterRedirects;
@@ -226,8 +247,10 @@ class GuardsCheckEnd extends RouterEvent {
226
247
  * @param {?} state
227
248
  * @param {?} shouldActivate
228
249
  */
229
- constructor(/** @docsNotRequired */
230
- id, /** @docsNotRequired */
250
+ constructor(
251
+ /** @docsNotRequired */
252
+ id,
253
+ /** @docsNotRequired */
231
254
  url, urlAfterRedirects, state, shouldActivate) {
232
255
  super(id, url);
233
256
  this.urlAfterRedirects = urlAfterRedirects;
@@ -258,8 +281,10 @@ class ResolveStart extends RouterEvent {
258
281
  * @param {?} urlAfterRedirects
259
282
  * @param {?} state
260
283
  */
261
- constructor(/** @docsNotRequired */
262
- id, /** @docsNotRequired */
284
+ constructor(
285
+ /** @docsNotRequired */
286
+ id,
287
+ /** @docsNotRequired */
263
288
  url, urlAfterRedirects, state) {
264
289
  super(id, url);
265
290
  this.urlAfterRedirects = urlAfterRedirects;
@@ -287,8 +312,10 @@ class ResolveEnd extends RouterEvent {
287
312
  * @param {?} urlAfterRedirects
288
313
  * @param {?} state
289
314
  */
290
- constructor(/** @docsNotRequired */
291
- id, /** @docsNotRequired */
315
+ constructor(
316
+ /** @docsNotRequired */
317
+ id,
318
+ /** @docsNotRequired */
292
319
  url, urlAfterRedirects, state) {
293
320
  super(id, url);
294
321
  this.urlAfterRedirects = urlAfterRedirects;
@@ -448,10 +475,7 @@ class Scroll {
448
475
  * @param {?} position
449
476
  * @param {?} anchor
450
477
  */
451
- constructor(/** @docsNotRequired */
452
- routerEvent, /** @docsNotRequired */
453
- position, /** @docsNotRequired */
454
- anchor) {
478
+ constructor(routerEvent, position, anchor) {
455
479
  this.routerEvent = routerEvent;
456
480
  this.position = position;
457
481
  this.anchor = anchor;
@@ -468,7 +492,7 @@ class Scroll {
468
492
 
469
493
  /**
470
494
  * @fileoverview added by tsickle
471
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
495
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
472
496
  */
473
497
  /**
474
498
  * This component is used internally within the router to be a placeholder when an empty
@@ -487,7 +511,7 @@ EmptyOutletComponent.decorators = [
487
511
 
488
512
  /**
489
513
  * @fileoverview added by tsickle
490
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
514
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
491
515
  */
492
516
  /**
493
517
  * @license
@@ -496,13 +520,14 @@ EmptyOutletComponent.decorators = [
496
520
  * Use of this source code is governed by an MIT-style license that can be
497
521
  * found in the LICENSE file at https://angular.io/license
498
522
  */
499
- /** *
523
+ /**
500
524
  * \@description
501
525
  *
502
526
  * Name of the primary outlet.
503
527
  *
504
528
  * \@publicApi
505
- @type {?} */
529
+ * @type {?}
530
+ */
506
531
  const PRIMARY_OUTLET = 'primary';
507
532
  class ParamsAsMap {
508
533
  /**
@@ -562,7 +587,7 @@ const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
562
587
  function navigationCancelingError(message) {
563
588
  /** @type {?} */
564
589
  const error = Error('NavigationCancelingError: ' + message);
565
- (/** @type {?} */ (error))[NAVIGATION_CANCELING_ERROR] = true;
590
+ ((/** @type {?} */ (error)))[NAVIGATION_CANCELING_ERROR] = true;
566
591
  return error;
567
592
  }
568
593
  /**
@@ -570,8 +595,9 @@ function navigationCancelingError(message) {
570
595
  * @return {?}
571
596
  */
572
597
  function isNavigationCancelingError(error) {
573
- return error && (/** @type {?} */ (error))[NAVIGATION_CANCELING_ERROR];
598
+ return error && ((/** @type {?} */ (error)))[NAVIGATION_CANCELING_ERROR];
574
599
  }
600
+ // Matches the route configuration (`route`) against the actual URL (`segments`).
575
601
  /**
576
602
  * @param {?} segments
577
603
  * @param {?} segmentGroup
@@ -580,7 +606,7 @@ function isNavigationCancelingError(error) {
580
606
  */
581
607
  function defaultUrlMatcher(segments, segmentGroup, route) {
582
608
  /** @type {?} */
583
- const parts = /** @type {?} */ ((route.path)).split('/');
609
+ const parts = (/** @type {?} */ (route.path)).split('/');
584
610
  if (parts.length > segments.length) {
585
611
  // The actual URL is shorter than the config, no match
586
612
  return null;
@@ -613,7 +639,7 @@ function defaultUrlMatcher(segments, segmentGroup, route) {
613
639
 
614
640
  /**
615
641
  * @fileoverview added by tsickle
616
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
642
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
617
643
  */
618
644
  class LoadedRouterConfig {
619
645
  /**
@@ -742,7 +768,7 @@ function standardizeConfig(r) {
742
768
 
743
769
  /**
744
770
  * @fileoverview added by tsickle
745
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
771
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
746
772
  */
747
773
  /**
748
774
  * @param {?} a
@@ -861,7 +887,7 @@ function wrapIntoObservable(value) {
861
887
 
862
888
  /**
863
889
  * @fileoverview added by tsickle
864
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
890
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
865
891
  */
866
892
  /**
867
893
  * @return {?}
@@ -1207,7 +1233,7 @@ class DefaultUrlSerializer {
1207
1233
  /** @type {?} */
1208
1234
  const query = serializeQueryParams(tree.queryParams);
1209
1235
  /** @type {?} */
1210
- const fragment = typeof tree.fragment === `string` ? `#${encodeUriFragment((/** @type {?} */ ((tree.fragment))))}` : '';
1236
+ const fragment = typeof tree.fragment === `string` ? `#${encodeUriFragment((/** @type {?} */ (tree.fragment)))}` : '';
1211
1237
  return `${segment}${query}${fragment}`;
1212
1238
  }
1213
1239
  }
@@ -1310,6 +1336,8 @@ function encodeUriSegment(s) {
1310
1336
  function decode(s) {
1311
1337
  return decodeURIComponent(s);
1312
1338
  }
1339
+ // Query keys/values should have the "+" replaced first, as "+" in a query string is " ".
1340
+ // decodeURIComponent function will not decode "+" as a space.
1313
1341
  /**
1314
1342
  * @param {?} s
1315
1343
  * @return {?}
@@ -1361,6 +1389,7 @@ function matchSegments(str) {
1361
1389
  }
1362
1390
  /** @type {?} */
1363
1391
  const QUERY_PARAM_RE = /^[^=?&#]+/;
1392
+ // Return the name of the query param at the start of the string or an empty string
1364
1393
  /**
1365
1394
  * @param {?} str
1366
1395
  * @return {?}
@@ -1372,6 +1401,7 @@ function matchQueryParams(str) {
1372
1401
  }
1373
1402
  /** @type {?} */
1374
1403
  const QUERY_PARAM_VALUE_RE = /^[^?&#]+/;
1404
+ // Return the value of the query param at the start of the string or an empty string
1375
1405
  /**
1376
1406
  * @param {?} str
1377
1407
  * @return {?}
@@ -1420,6 +1450,7 @@ class UrlParser {
1420
1450
  return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;
1421
1451
  }
1422
1452
  /**
1453
+ * @private
1423
1454
  * @return {?}
1424
1455
  */
1425
1456
  parseChildren() {
@@ -1452,7 +1483,10 @@ class UrlParser {
1452
1483
  }
1453
1484
  return res;
1454
1485
  }
1486
+ // parse a segment with its matrix parameters
1487
+ // ie `name;k1=v1;k2`
1455
1488
  /**
1489
+ * @private
1456
1490
  * @return {?}
1457
1491
  */
1458
1492
  parseSegment() {
@@ -1465,6 +1499,7 @@ class UrlParser {
1465
1499
  return new UrlSegment(decode(path), this.parseMatrixParams());
1466
1500
  }
1467
1501
  /**
1502
+ * @private
1468
1503
  * @return {?}
1469
1504
  */
1470
1505
  parseMatrixParams() {
@@ -1476,6 +1511,7 @@ class UrlParser {
1476
1511
  return params;
1477
1512
  }
1478
1513
  /**
1514
+ * @private
1479
1515
  * @param {?} params
1480
1516
  * @return {?}
1481
1517
  */
@@ -1498,7 +1534,9 @@ class UrlParser {
1498
1534
  }
1499
1535
  params[decode(key)] = decode(value);
1500
1536
  }
1537
+ // Parse a single query parameter `name[=value]`
1501
1538
  /**
1539
+ * @private
1502
1540
  * @param {?} params
1503
1541
  * @return {?}
1504
1542
  */
@@ -1524,6 +1562,7 @@ class UrlParser {
1524
1562
  /** @type {?} */
1525
1563
  const decodedVal = decodeQuery(value);
1526
1564
  if (params.hasOwnProperty(decodedKey)) {
1565
+ // Append to existing values
1527
1566
  /** @type {?} */
1528
1567
  let currentVal = params[decodedKey];
1529
1568
  if (!Array.isArray(currentVal)) {
@@ -1537,7 +1576,9 @@ class UrlParser {
1537
1576
  params[decodedKey] = decodedVal;
1538
1577
  }
1539
1578
  }
1579
+ // parse `(a/b//outlet_name:c/d)`
1540
1580
  /**
1581
+ * @private
1541
1582
  * @param {?} allowPrimary
1542
1583
  * @return {?}
1543
1584
  */
@@ -1556,7 +1597,7 @@ class UrlParser {
1556
1597
  throw new Error(`Cannot parse url '${this.url}'`);
1557
1598
  }
1558
1599
  /** @type {?} */
1559
- let outletName = /** @type {?} */ ((undefined));
1600
+ let outletName = (/** @type {?} */ (undefined));
1560
1601
  if (path.indexOf(':') > -1) {
1561
1602
  outletName = path.substr(0, path.indexOf(':'));
1562
1603
  this.capture(outletName);
@@ -1574,11 +1615,14 @@ class UrlParser {
1574
1615
  return segments;
1575
1616
  }
1576
1617
  /**
1618
+ * @private
1577
1619
  * @param {?} str
1578
1620
  * @return {?}
1579
1621
  */
1580
1622
  peekStartsWith(str) { return this.remaining.startsWith(str); }
1623
+ // Consumes the prefix when it is present and returns whether it has been consumed
1581
1624
  /**
1625
+ * @private
1582
1626
  * @param {?} str
1583
1627
  * @return {?}
1584
1628
  */
@@ -1590,6 +1634,7 @@ class UrlParser {
1590
1634
  return false;
1591
1635
  }
1592
1636
  /**
1637
+ * @private
1593
1638
  * @param {?} str
1594
1639
  * @return {?}
1595
1640
  */
@@ -1602,7 +1647,7 @@ class UrlParser {
1602
1647
 
1603
1648
  /**
1604
1649
  * @fileoverview added by tsickle
1605
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1650
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1606
1651
  */
1607
1652
  /**
1608
1653
  * @license
@@ -1674,6 +1719,7 @@ class Tree {
1674
1719
  */
1675
1720
  pathFromRoot(t) { return findPath(t, this._root).map(s => s.value); }
1676
1721
  }
1722
+ // DFS for the node matching the value
1677
1723
  /**
1678
1724
  * @template T
1679
1725
  * @param {?} value
@@ -1691,6 +1737,7 @@ function findNode(value, node) {
1691
1737
  }
1692
1738
  return null;
1693
1739
  }
1740
+ // Return the path to the node with the given value using DFS
1694
1741
  /**
1695
1742
  * @template T
1696
1743
  * @param {?} value
@@ -1727,6 +1774,7 @@ class TreeNode {
1727
1774
  */
1728
1775
  toString() { return `TreeNode(${this.value})`; }
1729
1776
  }
1777
+ // Return the list of T indexed by outlet name
1730
1778
  /**
1731
1779
  * @template T
1732
1780
  * @param {?} node
@@ -1743,7 +1791,7 @@ function nodeChildrenAsMap(node) {
1743
1791
 
1744
1792
  /**
1745
1793
  * @fileoverview added by tsickle
1746
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1794
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1747
1795
  */
1748
1796
  /**
1749
1797
  * \@description
@@ -1782,7 +1830,7 @@ class RouterState extends Tree {
1782
1830
  constructor(root, snapshot) {
1783
1831
  super(root);
1784
1832
  this.snapshot = snapshot;
1785
- setRouterState(/** @type {?} */ (this), root);
1833
+ setRouterState((/** @type {?} */ (this)), root);
1786
1834
  }
1787
1835
  /**
1788
1836
  * @return {?}
@@ -1977,7 +2025,7 @@ function flattenInherited(pathFromRoot) {
1977
2025
  /** @type {?} */
1978
2026
  const resolve = Object.assign({}, res.resolve, curr._resolvedData);
1979
2027
  return { params, data, resolve };
1980
- }, /** @type {?} */ ({ params: {}, data: {}, resolve: {} }));
2028
+ }, (/** @type {?} */ ({ params: {}, data: {}, resolve: {} })));
1981
2029
  }
1982
2030
  /**
1983
2031
  * \@description
@@ -2117,7 +2165,7 @@ class RouterStateSnapshot extends Tree {
2117
2165
  constructor(url, root) {
2118
2166
  super(root);
2119
2167
  this.url = url;
2120
- setRouterState(/** @type {?} */ (this), root);
2168
+ setRouterState((/** @type {?} */ (this)), root);
2121
2169
  }
2122
2170
  /**
2123
2171
  * @return {?}
@@ -2158,25 +2206,25 @@ function advanceActivatedRoute(route) {
2158
2206
  const nextSnapshot = route._futureSnapshot;
2159
2207
  route.snapshot = nextSnapshot;
2160
2208
  if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
2161
- (/** @type {?} */ (route.queryParams)).next(nextSnapshot.queryParams);
2209
+ ((/** @type {?} */ (route.queryParams))).next(nextSnapshot.queryParams);
2162
2210
  }
2163
2211
  if (currentSnapshot.fragment !== nextSnapshot.fragment) {
2164
- (/** @type {?} */ (route.fragment)).next(nextSnapshot.fragment);
2212
+ ((/** @type {?} */ (route.fragment))).next(nextSnapshot.fragment);
2165
2213
  }
2166
2214
  if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
2167
- (/** @type {?} */ (route.params)).next(nextSnapshot.params);
2215
+ ((/** @type {?} */ (route.params))).next(nextSnapshot.params);
2168
2216
  }
2169
2217
  if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
2170
- (/** @type {?} */ (route.url)).next(nextSnapshot.url);
2218
+ ((/** @type {?} */ (route.url))).next(nextSnapshot.url);
2171
2219
  }
2172
2220
  if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
2173
- (/** @type {?} */ (route.data)).next(nextSnapshot.data);
2221
+ ((/** @type {?} */ (route.data))).next(nextSnapshot.data);
2174
2222
  }
2175
2223
  }
2176
2224
  else {
2177
2225
  route.snapshot = route._futureSnapshot;
2178
2226
  // this is for resolved data
2179
- (/** @type {?} */ (route.data)).next(route._futureSnapshot.data);
2227
+ ((/** @type {?} */ (route.data))).next(route._futureSnapshot.data);
2180
2228
  }
2181
2229
  }
2182
2230
  /**
@@ -2190,12 +2238,12 @@ function equalParamsAndUrlSegments(a, b) {
2190
2238
  /** @type {?} */
2191
2239
  const parentsMismatch = !a.parent !== !b.parent;
2192
2240
  return equalUrlParams && !parentsMismatch &&
2193
- (!a.parent || equalParamsAndUrlSegments(a.parent, /** @type {?} */ ((b.parent))));
2241
+ (!a.parent || equalParamsAndUrlSegments(a.parent, (/** @type {?} */ (b.parent))));
2194
2242
  }
2195
2243
 
2196
2244
  /**
2197
2245
  * @fileoverview added by tsickle
2198
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2246
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2199
2247
  */
2200
2248
  /**
2201
2249
  * @param {?} routeReuseStrategy
@@ -2227,7 +2275,7 @@ function createNode(routeReuseStrategy, curr, prevState) {
2227
2275
  }
2228
2276
  else {
2229
2277
  /** @type {?} */
2230
- const detachedRouteHandle = /** @type {?} */ (routeReuseStrategy.retrieve(curr.value));
2278
+ const detachedRouteHandle = (/** @type {?} */ (routeReuseStrategy.retrieve(curr.value)));
2231
2279
  if (detachedRouteHandle) {
2232
2280
  /** @type {?} */
2233
2281
  const tree = detachedRouteHandle.route;
@@ -2286,7 +2334,7 @@ function createActivatedRoute(c) {
2286
2334
 
2287
2335
  /**
2288
2336
  * @fileoverview added by tsickle
2289
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2337
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2290
2338
  */
2291
2339
  /**
2292
2340
  * @param {?} route
@@ -2421,11 +2469,9 @@ function computeNavigation(commands) {
2421
2469
  cmd.split('/').forEach((urlPart, partIndex) => {
2422
2470
  if (partIndex == 0 && urlPart === '.') ;
2423
2471
  else if (partIndex == 0 && urlPart === '') { // '/a'
2424
- // '/a'
2425
2472
  isAbsolute = true;
2426
2473
  }
2427
2474
  else if (urlPart === '..') { // '../a'
2428
- // '../a'
2429
2475
  numberOfDoubleDots++;
2430
2476
  }
2431
2477
  else if (urlPart != '') {
@@ -2484,7 +2530,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
2484
2530
  let dd = numberOfDoubleDots;
2485
2531
  while (dd > ci) {
2486
2532
  dd -= ci;
2487
- g = /** @type {?} */ ((g.parent));
2533
+ g = (/** @type {?} */ (g.parent));
2488
2534
  if (!g) {
2489
2535
  throw new Error('Invalid number of \'../\'');
2490
2536
  }
@@ -2692,11 +2738,11 @@ function compare(path, params, segment) {
2692
2738
 
2693
2739
  /**
2694
2740
  * @fileoverview added by tsickle
2695
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2741
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2696
2742
  */
2697
2743
  /** @type {?} */
2698
2744
  const activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent) => map(t => {
2699
- new ActivateRoutes(routeReuseStrategy, /** @type {?} */ ((t.targetRouterState)), t.currentRouterState, forwardEvent)
2745
+ new ActivateRoutes(routeReuseStrategy, (/** @type {?} */ (t.targetRouterState)), t.currentRouterState, forwardEvent)
2700
2746
  .activate(rootContexts);
2701
2747
  return t;
2702
2748
  });
@@ -2726,7 +2772,9 @@ class ActivateRoutes {
2726
2772
  advanceActivatedRoute(this.futureState.root);
2727
2773
  this.activateChildRoutes(futureRoot, currRoot, parentContexts);
2728
2774
  }
2775
+ // De-activate the child route that are not re-used for the future state
2729
2776
  /**
2777
+ * @private
2730
2778
  * @param {?} futureNode
2731
2779
  * @param {?} currNode
2732
2780
  * @param {?} contexts
@@ -2748,6 +2796,7 @@ class ActivateRoutes {
2748
2796
  });
2749
2797
  }
2750
2798
  /**
2799
+ * @private
2751
2800
  * @param {?} futureNode
2752
2801
  * @param {?} currNode
2753
2802
  * @param {?} parentContext
@@ -2761,6 +2810,7 @@ class ActivateRoutes {
2761
2810
  if (future === curr) {
2762
2811
  // Reusing the node, check to see if the children need to be de-activated
2763
2812
  if (future.component) {
2813
+ // If we have a normal route, we need to go through an outlet.
2764
2814
  /** @type {?} */
2765
2815
  const context = parentContext.getContext(future.outlet);
2766
2816
  if (context) {
@@ -2780,6 +2830,7 @@ class ActivateRoutes {
2780
2830
  }
2781
2831
  }
2782
2832
  /**
2833
+ * @private
2783
2834
  * @param {?} route
2784
2835
  * @param {?} parentContexts
2785
2836
  * @return {?}
@@ -2793,6 +2844,7 @@ class ActivateRoutes {
2793
2844
  }
2794
2845
  }
2795
2846
  /**
2847
+ * @private
2796
2848
  * @param {?} route
2797
2849
  * @param {?} parentContexts
2798
2850
  * @return {?}
@@ -2809,6 +2861,7 @@ class ActivateRoutes {
2809
2861
  }
2810
2862
  }
2811
2863
  /**
2864
+ * @private
2812
2865
  * @param {?} route
2813
2866
  * @param {?} parentContexts
2814
2867
  * @return {?}
@@ -2831,6 +2884,7 @@ class ActivateRoutes {
2831
2884
  }
2832
2885
  }
2833
2886
  /**
2887
+ * @private
2834
2888
  * @param {?} futureNode
2835
2889
  * @param {?} currNode
2836
2890
  * @param {?} contexts
@@ -2848,6 +2902,7 @@ class ActivateRoutes {
2848
2902
  }
2849
2903
  }
2850
2904
  /**
2905
+ * @private
2851
2906
  * @param {?} futureNode
2852
2907
  * @param {?} currNode
2853
2908
  * @param {?} parentContexts
@@ -2862,6 +2917,7 @@ class ActivateRoutes {
2862
2917
  // reusing the node
2863
2918
  if (future === curr) {
2864
2919
  if (future.component) {
2920
+ // If we have a normal route, we need to go through an outlet.
2865
2921
  /** @type {?} */
2866
2922
  const context = parentContexts.getOrCreateContext(future.outlet);
2867
2923
  this.activateChildRoutes(futureNode, currNode, context.children);
@@ -2873,11 +2929,12 @@ class ActivateRoutes {
2873
2929
  }
2874
2930
  else {
2875
2931
  if (future.component) {
2932
+ // if we have a normal route, we need to place the component into the outlet and recurse.
2876
2933
  /** @type {?} */
2877
2934
  const context = parentContexts.getOrCreateContext(future.outlet);
2878
2935
  if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {
2879
2936
  /** @type {?} */
2880
- const stored = (/** @type {?} */ (this.routeReuseStrategy.retrieve(future.snapshot)));
2937
+ const stored = ((/** @type {?} */ (this.routeReuseStrategy.retrieve(future.snapshot))));
2881
2938
  this.routeReuseStrategy.store(future.snapshot, null);
2882
2939
  context.children.onOutletReAttached(stored.contexts);
2883
2940
  context.attachRef = stored.componentRef;
@@ -2938,7 +2995,7 @@ function parentLoadedConfig(snapshot) {
2938
2995
 
2939
2996
  /**
2940
2997
  * @fileoverview added by tsickle
2941
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2998
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2942
2999
  */
2943
3000
  /**
2944
3001
  * Simple function check, but generic so type inference will flow. Example:
@@ -3005,7 +3062,7 @@ function isCanDeactivate(guard) {
3005
3062
 
3006
3063
  /**
3007
3064
  * @fileoverview added by tsickle
3008
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3065
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3009
3066
  */
3010
3067
  class NoMatch {
3011
3068
  /**
@@ -3086,7 +3143,7 @@ class ApplyRedirects {
3086
3143
  /** @type {?} */
3087
3144
  const expanded$ = this.expandSegmentGroup(this.ngModule, this.config, this.urlTree.root, PRIMARY_OUTLET);
3088
3145
  /** @type {?} */
3089
- const urlTrees$ = expanded$.pipe(map((rootSegmentGroup) => this.createUrlTree(rootSegmentGroup, this.urlTree.queryParams, /** @type {?} */ ((this.urlTree.fragment)))));
3146
+ const urlTrees$ = expanded$.pipe(map((rootSegmentGroup) => this.createUrlTree(rootSegmentGroup, this.urlTree.queryParams, (/** @type {?} */ (this.urlTree.fragment)))));
3090
3147
  return urlTrees$.pipe(catchError((e) => {
3091
3148
  if (e instanceof AbsoluteRedirect) {
3092
3149
  // after an absolute redirect we do not apply any more redirects!
@@ -3101,6 +3158,7 @@ class ApplyRedirects {
3101
3158
  }));
3102
3159
  }
3103
3160
  /**
3161
+ * @private
3104
3162
  * @param {?} tree
3105
3163
  * @return {?}
3106
3164
  */
@@ -3108,7 +3166,7 @@ class ApplyRedirects {
3108
3166
  /** @type {?} */
3109
3167
  const expanded$ = this.expandSegmentGroup(this.ngModule, this.config, tree.root, PRIMARY_OUTLET);
3110
3168
  /** @type {?} */
3111
- const mapped$ = expanded$.pipe(map((rootSegmentGroup) => this.createUrlTree(rootSegmentGroup, tree.queryParams, /** @type {?} */ ((tree.fragment)))));
3169
+ const mapped$ = expanded$.pipe(map((rootSegmentGroup) => this.createUrlTree(rootSegmentGroup, tree.queryParams, (/** @type {?} */ (tree.fragment)))));
3112
3170
  return mapped$.pipe(catchError((e) => {
3113
3171
  if (e instanceof NoMatch) {
3114
3172
  throw this.noMatchError(e);
@@ -3117,6 +3175,7 @@ class ApplyRedirects {
3117
3175
  }));
3118
3176
  }
3119
3177
  /**
3178
+ * @private
3120
3179
  * @param {?} e
3121
3180
  * @return {?}
3122
3181
  */
@@ -3124,6 +3183,7 @@ class ApplyRedirects {
3124
3183
  return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3125
3184
  }
3126
3185
  /**
3186
+ * @private
3127
3187
  * @param {?} rootCandidate
3128
3188
  * @param {?} queryParams
3129
3189
  * @param {?} fragment
@@ -3137,6 +3197,7 @@ class ApplyRedirects {
3137
3197
  return new UrlTree(root, queryParams, fragment);
3138
3198
  }
3139
3199
  /**
3200
+ * @private
3140
3201
  * @param {?} ngModule
3141
3202
  * @param {?} routes
3142
3203
  * @param {?} segmentGroup
@@ -3150,7 +3211,9 @@ class ApplyRedirects {
3150
3211
  }
3151
3212
  return this.expandSegment(ngModule, segmentGroup, routes, segmentGroup.segments, outlet, true);
3152
3213
  }
3214
+ // Recursively expand segment groups for all the child outlets
3153
3215
  /**
3216
+ * @private
3154
3217
  * @param {?} ngModule
3155
3218
  * @param {?} routes
3156
3219
  * @param {?} segmentGroup
@@ -3160,6 +3223,7 @@ class ApplyRedirects {
3160
3223
  return waitForMap(segmentGroup.children, (childOutlet, child) => this.expandSegmentGroup(ngModule, routes, child, childOutlet));
3161
3224
  }
3162
3225
  /**
3226
+ * @private
3163
3227
  * @param {?} ngModule
3164
3228
  * @param {?} segmentGroup
3165
3229
  * @param {?} routes
@@ -3176,7 +3240,7 @@ class ApplyRedirects {
3176
3240
  if (e instanceof NoMatch) {
3177
3241
  // TODO(i): this return type doesn't match the declared Observable<UrlSegmentGroup> -
3178
3242
  // talk to Jason
3179
- return /** @type {?} */ (of(null));
3243
+ return (/** @type {?} */ (of(null)));
3180
3244
  }
3181
3245
  throw e;
3182
3246
  }));
@@ -3191,6 +3255,7 @@ class ApplyRedirects {
3191
3255
  }));
3192
3256
  }
3193
3257
  /**
3258
+ * @private
3194
3259
  * @param {?} segmentGroup
3195
3260
  * @param {?} segments
3196
3261
  * @param {?} outlet
@@ -3200,6 +3265,7 @@ class ApplyRedirects {
3200
3265
  return segments.length === 0 && !segmentGroup.children[outlet];
3201
3266
  }
3202
3267
  /**
3268
+ * @private
3203
3269
  * @param {?} ngModule
3204
3270
  * @param {?} segmentGroup
3205
3271
  * @param {?} routes
@@ -3222,6 +3288,7 @@ class ApplyRedirects {
3222
3288
  return noMatch(segmentGroup);
3223
3289
  }
3224
3290
  /**
3291
+ * @private
3225
3292
  * @param {?} ngModule
3226
3293
  * @param {?} segmentGroup
3227
3294
  * @param {?} routes
@@ -3237,6 +3304,7 @@ class ApplyRedirects {
3237
3304
  return this.expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet);
3238
3305
  }
3239
3306
  /**
3307
+ * @private
3240
3308
  * @param {?} ngModule
3241
3309
  * @param {?} routes
3242
3310
  * @param {?} route
@@ -3245,8 +3313,8 @@ class ApplyRedirects {
3245
3313
  */
3246
3314
  expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet) {
3247
3315
  /** @type {?} */
3248
- const newTree = this.applyRedirectCommands([], /** @type {?} */ ((route.redirectTo)), {});
3249
- if (/** @type {?} */ ((route.redirectTo)).startsWith('/')) {
3316
+ const newTree = this.applyRedirectCommands([], (/** @type {?} */ (route.redirectTo)), {});
3317
+ if ((/** @type {?} */ (route.redirectTo)).startsWith('/')) {
3250
3318
  return absoluteRedirect(newTree);
3251
3319
  }
3252
3320
  return this.lineralizeSegments(route, newTree).pipe(mergeMap((newSegments) => {
@@ -3256,6 +3324,7 @@ class ApplyRedirects {
3256
3324
  }));
3257
3325
  }
3258
3326
  /**
3327
+ * @private
3259
3328
  * @param {?} ngModule
3260
3329
  * @param {?} segmentGroup
3261
3330
  * @param {?} routes
@@ -3269,8 +3338,8 @@ class ApplyRedirects {
3269
3338
  if (!matched)
3270
3339
  return noMatch(segmentGroup);
3271
3340
  /** @type {?} */
3272
- const newTree = this.applyRedirectCommands(consumedSegments, /** @type {?} */ ((route.redirectTo)), /** @type {?} */ (positionalParamSegments));
3273
- if (/** @type {?} */ ((route.redirectTo)).startsWith('/')) {
3341
+ const newTree = this.applyRedirectCommands(consumedSegments, (/** @type {?} */ (route.redirectTo)), (/** @type {?} */ (positionalParamSegments)));
3342
+ if ((/** @type {?} */ (route.redirectTo)).startsWith('/')) {
3274
3343
  return absoluteRedirect(newTree);
3275
3344
  }
3276
3345
  return this.lineralizeSegments(route, newTree).pipe(mergeMap((newSegments) => {
@@ -3278,6 +3347,7 @@ class ApplyRedirects {
3278
3347
  }));
3279
3348
  }
3280
3349
  /**
3350
+ * @private
3281
3351
  * @param {?} ngModule
3282
3352
  * @param {?} rawSegmentGroup
3283
3353
  * @param {?} route
@@ -3322,6 +3392,7 @@ class ApplyRedirects {
3322
3392
  }));
3323
3393
  }
3324
3394
  /**
3395
+ * @private
3325
3396
  * @param {?} ngModule
3326
3397
  * @param {?} route
3327
3398
  * @param {?} segments
@@ -3352,6 +3423,7 @@ class ApplyRedirects {
3352
3423
  return of(new LoadedRouterConfig([], ngModule));
3353
3424
  }
3354
3425
  /**
3426
+ * @private
3355
3427
  * @param {?} route
3356
3428
  * @param {?} urlTree
3357
3429
  * @return {?}
@@ -3367,12 +3439,13 @@ class ApplyRedirects {
3367
3439
  return of(res);
3368
3440
  }
3369
3441
  if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
3370
- return namedOutletsRedirect(/** @type {?} */ ((route.redirectTo)));
3442
+ return namedOutletsRedirect((/** @type {?} */ (route.redirectTo)));
3371
3443
  }
3372
3444
  c = c.children[PRIMARY_OUTLET];
3373
3445
  }
3374
3446
  }
3375
3447
  /**
3448
+ * @private
3376
3449
  * @param {?} segments
3377
3450
  * @param {?} redirectTo
3378
3451
  * @param {?} posParams
@@ -3382,6 +3455,7 @@ class ApplyRedirects {
3382
3455
  return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3383
3456
  }
3384
3457
  /**
3458
+ * @private
3385
3459
  * @param {?} redirectTo
3386
3460
  * @param {?} urlTree
3387
3461
  * @param {?} segments
@@ -3394,6 +3468,7 @@ class ApplyRedirects {
3394
3468
  return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
3395
3469
  }
3396
3470
  /**
3471
+ * @private
3397
3472
  * @param {?} redirectToParams
3398
3473
  * @param {?} actualParams
3399
3474
  * @return {?}
@@ -3416,6 +3491,7 @@ class ApplyRedirects {
3416
3491
  return res;
3417
3492
  }
3418
3493
  /**
3494
+ * @private
3419
3495
  * @param {?} redirectTo
3420
3496
  * @param {?} group
3421
3497
  * @param {?} segments
@@ -3433,6 +3509,7 @@ class ApplyRedirects {
3433
3509
  return new UrlSegmentGroup(updatedSegments, children);
3434
3510
  }
3435
3511
  /**
3512
+ * @private
3436
3513
  * @param {?} redirectTo
3437
3514
  * @param {?} redirectToSegments
3438
3515
  * @param {?} actualSegments
@@ -3444,6 +3521,7 @@ class ApplyRedirects {
3444
3521
  this.findOrReturn(s, actualSegments));
3445
3522
  }
3446
3523
  /**
3524
+ * @private
3447
3525
  * @param {?} redirectTo
3448
3526
  * @param {?} redirectToUrlSegment
3449
3527
  * @param {?} posParams
@@ -3457,6 +3535,7 @@ class ApplyRedirects {
3457
3535
  return pos;
3458
3536
  }
3459
3537
  /**
3538
+ * @private
3460
3539
  * @param {?} redirectToUrlSegment
3461
3540
  * @param {?} actualSegments
3462
3541
  * @return {?}
@@ -3524,16 +3603,16 @@ function match(segmentGroup, route, segments) {
3524
3603
  if (!res) {
3525
3604
  return {
3526
3605
  matched: false,
3527
- consumedSegments: /** @type {?} */ ([]),
3606
+ consumedSegments: (/** @type {?} */ ([])),
3528
3607
  lastChild: 0,
3529
3608
  positionalParamSegments: {},
3530
3609
  };
3531
3610
  }
3532
3611
  return {
3533
3612
  matched: true,
3534
- consumedSegments: /** @type {?} */ ((res.consumed)),
3535
- lastChild: /** @type {?} */ ((res.consumed.length)),
3536
- positionalParamSegments: /** @type {?} */ ((res.posParams)),
3613
+ consumedSegments: (/** @type {?} */ (res.consumed)),
3614
+ lastChild: (/** @type {?} */ (res.consumed.length)),
3615
+ positionalParamSegments: (/** @type {?} */ (res.posParams)),
3537
3616
  };
3538
3617
  }
3539
3618
  /**
@@ -3643,7 +3722,7 @@ function getOutlet(route) {
3643
3722
 
3644
3723
  /**
3645
3724
  * @fileoverview added by tsickle
3646
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3725
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3647
3726
  */
3648
3727
  /**
3649
3728
  * @param {?} moduleInjector
@@ -3661,7 +3740,7 @@ function applyRedirects$1(moduleInjector, configLoader, urlSerializer, config) {
3661
3740
 
3662
3741
  /**
3663
3742
  * @fileoverview added by tsickle
3664
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3743
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3665
3744
  */
3666
3745
  class CanActivate {
3667
3746
  /**
@@ -3754,7 +3833,7 @@ function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks
3754
3833
  delete prevChildren[c.value.outlet];
3755
3834
  });
3756
3835
  // Process any children left from the current route (not active for the future route)
3757
- forEach(prevChildren, (v, k) => deactivateRouteAndItsChildren(v, /** @type {?} */ ((contexts)).getContext(k), checks));
3836
+ forEach(prevChildren, (v, k) => deactivateRouteAndItsChildren(v, (/** @type {?} */ (contexts)).getContext(k), checks));
3758
3837
  return checks;
3759
3838
  }
3760
3839
  /**
@@ -3778,7 +3857,7 @@ function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks
3778
3857
  // reusing the node
3779
3858
  if (curr && future.routeConfig === curr.routeConfig) {
3780
3859
  /** @type {?} */
3781
- const shouldRun = shouldRunGuardsAndResolvers(curr, future, /** @type {?} */ ((future.routeConfig)).runGuardsAndResolvers);
3860
+ const shouldRun = shouldRunGuardsAndResolvers(curr, future, (/** @type {?} */ (future.routeConfig)).runGuardsAndResolvers);
3782
3861
  if (shouldRun) {
3783
3862
  checks.canActivateChecks.push(new CanActivate(futurePath));
3784
3863
  }
@@ -3824,9 +3903,15 @@ function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks
3824
3903
  * @return {?}
3825
3904
  */
3826
3905
  function shouldRunGuardsAndResolvers(curr, future, mode) {
3906
+ if (typeof mode === 'function') {
3907
+ return mode(curr, future);
3908
+ }
3827
3909
  switch (mode) {
3828
3910
  case 'pathParamsChange':
3829
3911
  return !equalPath(curr.url, future.url);
3912
+ case 'pathParamsOrQueryParamsChange':
3913
+ return !equalPath(curr.url, future.url) ||
3914
+ !shallowEqual(curr.queryParams, future.queryParams);
3830
3915
  case 'always':
3831
3916
  return true;
3832
3917
  case 'paramsOrQueryParamsChange':
@@ -3872,7 +3957,7 @@ function deactivateRouteAndItsChildren(route, context, checks) {
3872
3957
 
3873
3958
  /**
3874
3959
  * @fileoverview added by tsickle
3875
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3960
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3876
3961
  */
3877
3962
  /** @type {?} */
3878
3963
  const INITIAL_VALUE = Symbol('INITIAL_VALUE');
@@ -3881,7 +3966,7 @@ const INITIAL_VALUE = Symbol('INITIAL_VALUE');
3881
3966
  */
3882
3967
  function prioritizedGuardValue() {
3883
3968
  return switchMap(obs => {
3884
- return /** @type {?} */ (combineLatest(...obs.map(o => o.pipe(take(1), startWith(/** @type {?} */ (INITIAL_VALUE)))))
3969
+ return (/** @type {?} */ (combineLatest(...obs.map(o => o.pipe(take(1), startWith((/** @type {?} */ (INITIAL_VALUE))))))
3885
3970
  .pipe(scan((acc, list) => {
3886
3971
  /** @type {?} */
3887
3972
  let isPending = false;
@@ -3907,14 +3992,13 @@ function prioritizedGuardValue() {
3907
3992
  return innerAcc;
3908
3993
  }, acc);
3909
3994
  }, INITIAL_VALUE), filter(item => item !== INITIAL_VALUE), map(item => isUrlTree(item) ? item : item === true), //
3910
- //
3911
- take(1)));
3995
+ take(1))));
3912
3996
  });
3913
3997
  }
3914
3998
 
3915
3999
  /**
3916
4000
  * @fileoverview added by tsickle
3917
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4001
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3918
4002
  */
3919
4003
  /**
3920
4004
  * @param {?} moduleInjector
@@ -3928,10 +4012,10 @@ function checkGuards(moduleInjector, forwardEvent) {
3928
4012
  if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
3929
4013
  return of(Object.assign({}, t, { guardsResult: true }));
3930
4014
  }
3931
- return runCanDeactivateChecks(canDeactivateChecks, /** @type {?} */ ((targetSnapshot)), currentSnapshot, moduleInjector)
4015
+ return runCanDeactivateChecks(canDeactivateChecks, (/** @type {?} */ (targetSnapshot)), currentSnapshot, moduleInjector)
3932
4016
  .pipe(mergeMap(canDeactivate => {
3933
4017
  return canDeactivate && isBoolean(canDeactivate) ?
3934
- runCanActivateChecks(/** @type {?} */ ((targetSnapshot)), canActivateChecks, moduleInjector, forwardEvent) :
4018
+ runCanActivateChecks((/** @type {?} */ (targetSnapshot)), canActivateChecks, moduleInjector, forwardEvent) :
3935
4019
  of(canDeactivate);
3936
4020
  }), map(guardsResult => (Object.assign({}, t, { guardsResult }))));
3937
4021
  }));
@@ -3945,7 +4029,7 @@ function checkGuards(moduleInjector, forwardEvent) {
3945
4029
  * @return {?}
3946
4030
  */
3947
4031
  function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) {
3948
- return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector)), first(result => { return result !== true; }, /** @type {?} */ (true)));
4032
+ return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector)), first(result => { return result !== true; }, (/** @type {?} */ (true))));
3949
4033
  }
3950
4034
  /**
3951
4035
  * @param {?} futureSnapshot
@@ -3964,8 +4048,8 @@ function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEve
3964
4048
  ])
3965
4049
  .pipe(concatAll(), first(result => {
3966
4050
  return result !== true;
3967
- }, /** @type {?} */ (true)));
3968
- }), first(result => { return result !== true; }, /** @type {?} */ (true)));
4051
+ }, (/** @type {?} */ (true))));
4052
+ }), first(result => { return result !== true; }, (/** @type {?} */ (true))));
3969
4053
  }
3970
4054
  /**
3971
4055
  * This should fire off `ActivationStart` events for each route being activated at this
@@ -4093,7 +4177,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
4093
4177
  let observable;
4094
4178
  if (isCanDeactivate(guard)) {
4095
4179
  observable =
4096
- wrapIntoObservable(guard.canDeactivate(/** @type {?} */ ((component)), currARS, currRSS, futureRSS));
4180
+ wrapIntoObservable(guard.canDeactivate((/** @type {?} */ (component)), currARS, currRSS, futureRSS));
4097
4181
  }
4098
4182
  else if (isFunction(guard)) {
4099
4183
  observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
@@ -4108,7 +4192,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
4108
4192
 
4109
4193
  /**
4110
4194
  * @fileoverview added by tsickle
4111
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4195
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4112
4196
  */
4113
4197
  class NoMatch$1 {
4114
4198
  }
@@ -4152,7 +4236,7 @@ class Recognizer {
4152
4236
  /** @type {?} */
4153
4237
  const children = this.processSegmentGroup(this.config, rootSegmentGroup, PRIMARY_OUTLET);
4154
4238
  /** @type {?} */
4155
- const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(Object.assign({}, this.urlTree.queryParams)), /** @type {?} */ ((this.urlTree.fragment)), {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {});
4239
+ const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(Object.assign({}, this.urlTree.queryParams)), (/** @type {?} */ (this.urlTree.fragment)), {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {});
4156
4240
  /** @type {?} */
4157
4241
  const rootNode = new TreeNode(root, children);
4158
4242
  /** @type {?} */
@@ -4224,6 +4308,7 @@ class Recognizer {
4224
4308
  throw new NoMatch$1();
4225
4309
  }
4226
4310
  /**
4311
+ * @private
4227
4312
  * @param {?} segmentGroup
4228
4313
  * @param {?} segments
4229
4314
  * @param {?} outlet
@@ -4252,15 +4337,15 @@ class Recognizer {
4252
4337
  let rawSlicedSegments = [];
4253
4338
  if (route.path === '**') {
4254
4339
  /** @type {?} */
4255
- const params = segments.length > 0 ? /** @type {?} */ ((last$1(segments))).parameters : {};
4256
- snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze(Object.assign({}, this.urlTree.queryParams)), /** @type {?} */ ((this.urlTree.fragment)), getData(route), outlet, /** @type {?} */ ((route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route));
4340
+ const params = segments.length > 0 ? (/** @type {?} */ (last$1(segments))).parameters : {};
4341
+ snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze(Object.assign({}, this.urlTree.queryParams)), (/** @type {?} */ (this.urlTree.fragment)), getData(route), outlet, (/** @type {?} */ (route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route));
4257
4342
  }
4258
4343
  else {
4259
4344
  /** @type {?} */
4260
4345
  const result = match$1(rawSegment, route, segments);
4261
4346
  consumedSegments = result.consumedSegments;
4262
4347
  rawSlicedSegments = segments.slice(result.lastChild);
4263
- snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), /** @type {?} */ ((this.urlTree.fragment)), getData(route), outlet, /** @type {?} */ ((route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route));
4348
+ snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), (/** @type {?} */ (this.urlTree.fragment)), getData(route), outlet, (/** @type {?} */ (route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route));
4264
4349
  }
4265
4350
  /** @type {?} */
4266
4351
  const childConfig = getChildConfig(route);
@@ -4300,7 +4385,7 @@ function getChildConfig(route) {
4300
4385
  return route.children;
4301
4386
  }
4302
4387
  if (route.loadChildren) {
4303
- return /** @type {?} */ ((route._loadedConfig)).routes;
4388
+ return (/** @type {?} */ (route._loadedConfig)).routes;
4304
4389
  }
4305
4390
  return [];
4306
4391
  }
@@ -4325,7 +4410,7 @@ function match$1(segmentGroup, route, segments) {
4325
4410
  throw new NoMatch$1();
4326
4411
  /** @type {?} */
4327
4412
  const posParams = {};
4328
- forEach(/** @type {?} */ ((res.posParams)), (v, k) => { posParams[k] = v.path; });
4413
+ forEach((/** @type {?} */ (res.posParams)), (v, k) => { posParams[k] = v.path; });
4329
4414
  /** @type {?} */
4330
4415
  const parameters = res.consumed.length > 0 ? Object.assign({}, posParams, res.consumed[res.consumed.length - 1].parameters) :
4331
4416
  posParams;
@@ -4515,7 +4600,7 @@ function getResolve(route) {
4515
4600
 
4516
4601
  /**
4517
4602
  * @fileoverview added by tsickle
4518
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4603
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4519
4604
  */
4520
4605
  /**
4521
4606
  * @param {?} rootComponentType
@@ -4534,7 +4619,7 @@ function recognize$1(rootComponentType, config, serializer, paramsInheritanceStr
4534
4619
 
4535
4620
  /**
4536
4621
  * @fileoverview added by tsickle
4537
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4622
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4538
4623
  */
4539
4624
  /**
4540
4625
  * @param {?} paramsInheritanceStrategy
@@ -4549,7 +4634,7 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
4549
4634
  return of(t);
4550
4635
  }
4551
4636
  return from(canActivateChecks)
4552
- .pipe(concatMap(check => runResolve(check.route, /** @type {?} */ ((targetSnapshot)), paramsInheritanceStrategy, moduleInjector)), reduce((_, __) => _), map(_ => t));
4637
+ .pipe(concatMap(check => runResolve(check.route, (/** @type {?} */ (targetSnapshot)), paramsInheritanceStrategy, moduleInjector)), reduce((_, __) => _), map(_ => t));
4553
4638
  }));
4554
4639
  };
4555
4640
  }
@@ -4617,7 +4702,7 @@ function getResolver(injectionToken, futureARS, futureRSS, moduleInjector) {
4617
4702
 
4618
4703
  /**
4619
4704
  * @fileoverview added by tsickle
4620
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4705
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4621
4706
  */
4622
4707
  /**
4623
4708
  * Perform a side effect through a switchMap for every emission on the source Observable,
@@ -4643,7 +4728,14 @@ function switchTap(next) {
4643
4728
 
4644
4729
  /**
4645
4730
  * @fileoverview added by tsickle
4646
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4731
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4732
+ */
4733
+ /**
4734
+ * @license
4735
+ * Copyright Google Inc. All Rights Reserved.
4736
+ *
4737
+ * Use of this source code is governed by an MIT-style license that can be
4738
+ * found in the LICENSE file at https://angular.io/license
4647
4739
  */
4648
4740
  /**
4649
4741
  * \@description
@@ -4692,12 +4784,13 @@ class DefaultRouteReuseStrategy {
4692
4784
 
4693
4785
  /**
4694
4786
  * @fileoverview added by tsickle
4695
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4787
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4696
4788
  */
4697
- /** *
4789
+ /**
4698
4790
  * \@docsNotRequired
4699
4791
  * \@publicApi
4700
- @type {?} */
4792
+ * @type {?}
4793
+ */
4701
4794
  const ROUTES = new InjectionToken('ROUTES');
4702
4795
  class RouterConfigLoader {
4703
4796
  /**
@@ -4722,7 +4815,7 @@ class RouterConfigLoader {
4722
4815
  this.onLoadStartListener(route);
4723
4816
  }
4724
4817
  /** @type {?} */
4725
- const moduleFactory$ = this.loadModuleFactory(/** @type {?} */ ((route.loadChildren)));
4818
+ const moduleFactory$ = this.loadModuleFactory((/** @type {?} */ (route.loadChildren)));
4726
4819
  return moduleFactory$.pipe(map((factory) => {
4727
4820
  if (this.onLoadEndListener) {
4728
4821
  this.onLoadEndListener(route);
@@ -4733,6 +4826,7 @@ class RouterConfigLoader {
4733
4826
  }));
4734
4827
  }
4735
4828
  /**
4829
+ * @private
4736
4830
  * @param {?} loadChildren
4737
4831
  * @return {?}
4738
4832
  */
@@ -4755,7 +4849,7 @@ class RouterConfigLoader {
4755
4849
 
4756
4850
  /**
4757
4851
  * @fileoverview added by tsickle
4758
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4852
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4759
4853
  */
4760
4854
  /**
4761
4855
  * @license
@@ -4798,7 +4892,7 @@ class DefaultUrlHandlingStrategy {
4798
4892
 
4799
4893
  /**
4800
4894
  * @fileoverview added by tsickle
4801
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4895
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4802
4896
  */
4803
4897
  /**
4804
4898
  * @param {?} error
@@ -4823,7 +4917,7 @@ function defaultMalformedUriErrorHandler(error, urlSerializer, url) {
4823
4917
  * @return {?}
4824
4918
  */
4825
4919
  function defaultRouterHook(snapshot, runExtras) {
4826
- return /** @type {?} */ (of(null));
4920
+ return (/** @type {?} */ (of(null)));
4827
4921
  }
4828
4922
  /**
4829
4923
  * \@description
@@ -4848,12 +4942,15 @@ class Router {
4848
4942
  * @param {?} compiler
4849
4943
  * @param {?} config
4850
4944
  */
4945
+ // TODO: vsavkin make internal after the final is out.
4851
4946
  constructor(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) {
4852
4947
  this.rootComponentType = rootComponentType;
4853
4948
  this.urlSerializer = urlSerializer;
4854
4949
  this.rootContexts = rootContexts;
4855
4950
  this.location = location;
4856
4951
  this.config = config;
4952
+ this.lastSuccessfulNavigation = null;
4953
+ this.currentNavigation = null;
4857
4954
  this.navigationId = 0;
4858
4955
  this.isNgZoneEnabled = false;
4859
4956
  this.events = new Subject();
@@ -4945,7 +5042,7 @@ class Router {
4945
5042
  reject: null,
4946
5043
  promise: Promise.resolve(true),
4947
5044
  source: 'imperative',
4948
- state: null,
5045
+ restoredState: null,
4949
5046
  currentSnapshot: this.routerState.snapshot,
4950
5047
  targetSnapshot: null,
4951
5048
  currentRouterState: this.routerState,
@@ -4957,15 +5054,28 @@ class Router {
4957
5054
  this.processNavigations();
4958
5055
  }
4959
5056
  /**
5057
+ * @private
4960
5058
  * @param {?} transitions
4961
5059
  * @return {?}
4962
5060
  */
4963
5061
  setupNavigations(transitions) {
4964
5062
  /** @type {?} */
4965
- const eventsSubject = (/** @type {?} */ (this.events));
4966
- return /** @type {?} */ ((transitions.pipe(filter(t => t.id !== 0),
5063
+ const eventsSubject = ((/** @type {?} */ (this.events)));
5064
+ return (/** @type {?} */ ((/** @type {?} */ (transitions.pipe(filter(t => t.id !== 0),
4967
5065
  // Extract URL
4968
- map(t => (/** @type {?} */ (Object.assign({}, t, { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) })))),
5066
+ map(t => ((/** @type {?} */ (Object.assign({}, t, { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))))),
5067
+ // Store the Navigation object
5068
+ tap(t => {
5069
+ this.currentNavigation = {
5070
+ id: t.id,
5071
+ initialUrl: t.currentRawUrl,
5072
+ extractedUrl: t.extractedUrl,
5073
+ trigger: t.source,
5074
+ extras: t.extras,
5075
+ previousNavigation: this.lastSuccessfulNavigation ? Object.assign({}, this.lastSuccessfulNavigation, { previousNavigation: null }) :
5076
+ null
5077
+ };
5078
+ }),
4969
5079
  // Using switchMap so we cancel executing navigations when a new one comes in
4970
5080
  switchMap(t => {
4971
5081
  /** @type {?} */
@@ -4980,14 +5090,11 @@ class Router {
4980
5090
  this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4981
5091
  if (processCurrentUrl) {
4982
5092
  return of(t).pipe(
4983
- // Update URL if in `eager` update mode
4984
- tap(t => this.urlUpdateStrategy === 'eager' && !t.extras.skipLocationChange &&
4985
- this.setBrowserUrl(t.rawUrl, !!t.extras.replaceUrl, t.id)),
4986
5093
  // Fire NavigationStart event
4987
5094
  switchMap(t => {
4988
5095
  /** @type {?} */
4989
5096
  const transition = this.transitions.getValue();
4990
- eventsSubject.next(new NavigationStart(t.id, this.serializeUrl(t.extractedUrl), t.source, t.state));
5097
+ eventsSubject.next(new NavigationStart(t.id, this.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4991
5098
  if (transition !== this.transitions.getValue()) {
4992
5099
  return EMPTY;
4993
5100
  }
@@ -4998,12 +5105,19 @@ class Router {
4998
5105
  switchMap(t => Promise.resolve(t)),
4999
5106
  // ApplyRedirects
5000
5107
  applyRedirects$1(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config),
5108
+ // Update the currentNavigation
5109
+ tap(t => {
5110
+ this.currentNavigation = Object.assign({}, (/** @type {?} */ (this.currentNavigation)), { finalUrl: t.urlAfterRedirects });
5111
+ }),
5001
5112
  // Recognize
5002
5113
  recognize$1(this.rootComponentType, this.config, (url) => this.serializeUrl(url), this.paramsInheritanceStrategy, this.relativeLinkResolution),
5114
+ // Update URL if in `eager` update mode
5115
+ tap(t => this.urlUpdateStrategy === 'eager' && !t.extras.skipLocationChange &&
5116
+ this.setBrowserUrl(t.urlAfterRedirects, !!t.extras.replaceUrl, t.id)),
5003
5117
  // Fire RoutesRecognized
5004
5118
  tap(t => {
5005
5119
  /** @type {?} */
5006
- const routesRecognized = new RoutesRecognized(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), /** @type {?} */ ((t.targetSnapshot)));
5120
+ const routesRecognized = new RoutesRecognized(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), (/** @type {?} */ (t.targetSnapshot)));
5007
5121
  eventsSubject.next(routesRecognized);
5008
5122
  }));
5009
5123
  }
@@ -5012,12 +5126,12 @@ class Router {
5012
5126
  const processPreviousUrl = urlTransition && this.rawUrlTree &&
5013
5127
  this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
5014
5128
  /* When the current URL shouldn't be processed, but the previous one was, we
5015
- * handle this "error condition" by navigating to the previously successful URL,
5016
- * but leaving the URL intact.*/
5129
+ * handle this "error condition" by navigating to the previously successful URL,
5130
+ * but leaving the URL intact.*/
5017
5131
  if (processPreviousUrl) {
5018
- const { id, extractedUrl, source, state, extras } = t;
5132
+ const { id, extractedUrl, source, restoredState, extras } = t;
5019
5133
  /** @type {?} */
5020
- const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, state);
5134
+ const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
5021
5135
  eventsSubject.next(navStart);
5022
5136
  /** @type {?} */
5023
5137
  const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
@@ -5025,9 +5139,9 @@ class Router {
5025
5139
  }
5026
5140
  else {
5027
5141
  /* When neither the current or previous URL can be processed, do nothing other
5028
- * than update router's internal reference to the current "settled" URL. This
5029
- * way the next navigation will be coming from the current URL in the browser.
5030
- */
5142
+ * than update router's internal reference to the current "settled" URL. This
5143
+ * way the next navigation will be coming from the current URL in the browser.
5144
+ */
5031
5145
  this.rawUrlTree = t.rawUrl;
5032
5146
  t.resolve(null);
5033
5147
  return EMPTY;
@@ -5037,7 +5151,7 @@ class Router {
5037
5151
  // Before Preactivation
5038
5152
  switchTap(t => {
5039
5153
  const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
5040
- return this.hooks.beforePreactivation(/** @type {?} */ ((targetSnapshot)), {
5154
+ return this.hooks.beforePreactivation((/** @type {?} */ (targetSnapshot)), {
5041
5155
  navigationId,
5042
5156
  appliedUrlTree,
5043
5157
  rawUrlTree,
@@ -5048,9 +5162,9 @@ class Router {
5048
5162
  // --- GUARDS ---
5049
5163
  tap(t => {
5050
5164
  /** @type {?} */
5051
- const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), /** @type {?} */ ((t.targetSnapshot)));
5165
+ const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), (/** @type {?} */ (t.targetSnapshot)));
5052
5166
  this.triggerEvent(guardsStart);
5053
- }), map(t => (Object.assign({}, t, { guards: getAllRouteGuards(/** @type {?} */ ((t.targetSnapshot)), t.currentSnapshot, this.rootContexts) }))), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
5167
+ }), map(t => (Object.assign({}, t, { guards: getAllRouteGuards((/** @type {?} */ (t.targetSnapshot)), t.currentSnapshot, this.rootContexts) }))), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
5054
5168
  if (isUrlTree(t.guardsResult)) {
5055
5169
  /** @type {?} */
5056
5170
  const error = navigationCancelingError(`Redirecting to "${this.serializeUrl(t.guardsResult)}"`);
@@ -5059,7 +5173,7 @@ class Router {
5059
5173
  }
5060
5174
  }), tap(t => {
5061
5175
  /** @type {?} */
5062
- const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), /** @type {?} */ ((t.targetSnapshot)), !!t.guardsResult);
5176
+ const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), (/** @type {?} */ (t.targetSnapshot)), !!t.guardsResult);
5063
5177
  this.triggerEvent(guardsEnd);
5064
5178
  }), filter(t => {
5065
5179
  if (!t.guardsResult) {
@@ -5077,58 +5191,56 @@ class Router {
5077
5191
  if (t.guards.canActivateChecks.length) {
5078
5192
  return of(t).pipe(tap(t => {
5079
5193
  /** @type {?} */
5080
- const resolveStart = new ResolveStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), /** @type {?} */ ((t.targetSnapshot)));
5194
+ const resolveStart = new ResolveStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), (/** @type {?} */ (t.targetSnapshot)));
5081
5195
  this.triggerEvent(resolveStart);
5082
5196
  }), resolveData(this.paramsInheritanceStrategy, this.ngModule.injector), //
5083
- //
5084
5197
  tap(t => {
5085
5198
  /** @type {?} */
5086
- const resolveEnd = new ResolveEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), /** @type {?} */ ((t.targetSnapshot)));
5199
+ const resolveEnd = new ResolveEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), (/** @type {?} */ (t.targetSnapshot)));
5087
5200
  this.triggerEvent(resolveEnd);
5088
5201
  }));
5089
5202
  }
5090
5203
  return undefined;
5091
5204
  }),
5092
5205
  // --- AFTER PREACTIVATION ---
5093
- switchTap(t => {
5206
+ switchTap((t) => {
5094
5207
  const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
5095
- return this.hooks.afterPreactivation(/** @type {?} */ ((targetSnapshot)), {
5208
+ return this.hooks.afterPreactivation((/** @type {?} */ (targetSnapshot)), {
5096
5209
  navigationId,
5097
5210
  appliedUrlTree,
5098
5211
  rawUrlTree,
5099
5212
  skipLocationChange: !!skipLocationChange,
5100
5213
  replaceUrl: !!replaceUrl,
5101
5214
  });
5102
- }), map(t => {
5215
+ }), map((t) => {
5103
5216
  /** @type {?} */
5104
- const targetRouterState = createRouterState(this.routeReuseStrategy, /** @type {?} */ ((t.targetSnapshot)), t.currentRouterState);
5217
+ const targetRouterState = createRouterState(this.routeReuseStrategy, (/** @type {?} */ (t.targetSnapshot)), t.currentRouterState);
5105
5218
  return (Object.assign({}, t, { targetRouterState }));
5106
- }), /* Once here, we are about to activate syncronously. The assumption is this will
5107
- succeed, and user code may read from the Router service. Therefore before
5108
- activation, we need to update router properties storing the current URL and the
5109
- RouterState, as well as updated the browser URL. All this should happen *before*
5110
- activating. */
5111
- tap(t => {
5219
+ }),
5220
+ /* Once here, we are about to activate syncronously. The assumption is this will
5221
+ succeed, and user code may read from the Router service. Therefore before
5222
+ activation, we need to update router properties storing the current URL and the
5223
+ RouterState, as well as updated the browser URL. All this should happen *before*
5224
+ activating. */
5225
+ tap((t) => {
5112
5226
  this.currentUrlTree = t.urlAfterRedirects;
5113
5227
  this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, t.rawUrl);
5114
- (/** @type {?} */ (this)).routerState = /** @type {?} */ ((t.targetRouterState));
5228
+ ((/** @type {?} */ (this))).routerState = (/** @type {?} */ (t.targetRouterState));
5115
5229
  if (this.urlUpdateStrategy === 'deferred' && !t.extras.skipLocationChange) {
5116
- this.setBrowserUrl(this.rawUrlTree, !!t.extras.replaceUrl, t.id);
5230
+ this.setBrowserUrl(this.rawUrlTree, !!t.extras.replaceUrl, t.id, t.extras.state);
5117
5231
  }
5118
- }), activateRoutes(this.rootContexts, this.routeReuseStrategy, (evt) => this.triggerEvent(evt)), tap({
5119
- /**
5232
+ }), activateRoutes(this.rootContexts, this.routeReuseStrategy, (evt) => this.triggerEvent(evt)), tap({ /**
5120
5233
  * @return {?}
5121
5234
  */
5122
5235
  next() { completed = true; }, /**
5123
5236
  * @return {?}
5124
5237
  */
5125
- complete() { completed = true; }
5126
- }), finalize(() => {
5238
+ complete() { completed = true; } }), finalize(() => {
5127
5239
  /* When the navigation stream finishes either through error or success, we set the
5128
- * `completed` or `errored` flag. However, there are some situations where we could
5129
- * get here without either of those being set. For instance, a redirect during
5130
- * NavigationStart. Therefore, this is a catch-all to make sure the NavigationCancel
5131
- * event is fired when a navigation gets cancelled but not caught by other means. */
5240
+ * `completed` or `errored` flag. However, there are some situations where we could
5241
+ * get here without either of those being set. For instance, a redirect during
5242
+ * NavigationStart. Therefore, this is a catch-all to make sure the NavigationCancel
5243
+ * event is fired when a navigation gets cancelled but not caught by other means. */
5132
5244
  if (!completed && !errored) {
5133
5245
  // Must reset to current URL tree here to ensure history.state is set. On a fresh
5134
5246
  // page load, if a new navigation comes in before a successful navigation
@@ -5142,10 +5254,14 @@ class Router {
5142
5254
  eventsSubject.next(navCancel);
5143
5255
  t.resolve(false);
5144
5256
  }
5257
+ // currentNavigation should always be reset to null here. If navigation was
5258
+ // successful, lastSuccessfulTransition will have already been set. Therefore we
5259
+ // can safely set currentNavigation to null here.
5260
+ this.currentNavigation = null;
5145
5261
  }), catchError((e) => {
5146
5262
  errored = true;
5147
5263
  /* This error type is issued during Redirect, and is handled as a cancellation
5148
- * rather than an error. */
5264
+ * rather than an error. */
5149
5265
  if (isNavigationCancelingError(e)) {
5150
5266
  this.navigated = true;
5151
5267
  /** @type {?} */
@@ -5161,7 +5277,7 @@ class Router {
5161
5277
  this.navigateByUrl(e.url);
5162
5278
  }
5163
5279
  /* All other errors should reset to the router's internal URL reference to the
5164
- * pre-error state. */
5280
+ * pre-error state. */
5165
5281
  }
5166
5282
  else {
5167
5283
  this.resetStateAndUrl(t.currentRouterState, t.currentUrlTree, t.rawUrl);
@@ -5178,7 +5294,7 @@ class Router {
5178
5294
  return EMPTY;
5179
5295
  }));
5180
5296
  // TODO(jasonaden): remove cast once g3 is on updated TypeScript
5181
- }))));
5297
+ }))))));
5182
5298
  }
5183
5299
  /**
5184
5300
  * \@internal
@@ -5193,10 +5309,12 @@ class Router {
5193
5309
  this.routerState.root.component = this.rootComponentType;
5194
5310
  }
5195
5311
  /**
5312
+ * @private
5196
5313
  * @return {?}
5197
5314
  */
5198
5315
  getTransition() { return this.transitions.value; }
5199
5316
  /**
5317
+ * @private
5200
5318
  * @param {?} t
5201
5319
  * @return {?}
5202
5320
  */
@@ -5222,17 +5340,17 @@ class Router {
5222
5340
  // already patch onPopState, so location change callback will
5223
5341
  // run into ngZone
5224
5342
  if (!this.locationSubscription) {
5225
- this.locationSubscription = /** @type {?} */ (this.location.subscribe((change) => {
5343
+ this.locationSubscription = (/** @type {?} */ (this.location.subscribe((change) => {
5226
5344
  /** @type {?} */
5227
5345
  let rawUrlTree = this.parseUrl(change['url']);
5228
5346
  /** @type {?} */
5229
5347
  const source = change['type'] === 'popstate' ? 'popstate' : 'hashchange';
5348
+ // Navigations coming from Angular router have a navigationId state property. When this
5349
+ // exists, restore the state.
5230
5350
  /** @type {?} */
5231
- const state = change.state && change.state.navigationId ?
5232
- { navigationId: change.state.navigationId } :
5233
- null;
5351
+ const state = change.state && change.state.navigationId ? change.state : null;
5234
5352
  setTimeout(() => { this.scheduleNavigation(rawUrlTree, source, state, { replaceUrl: true }); }, 0);
5235
- }));
5353
+ })));
5236
5354
  }
5237
5355
  }
5238
5356
  /**
@@ -5240,12 +5358,17 @@ class Router {
5240
5358
  * @return {?}
5241
5359
  */
5242
5360
  get url() { return this.serializeUrl(this.currentUrlTree); }
5361
+ /**
5362
+ * The current Navigation object if one exists
5363
+ * @return {?}
5364
+ */
5365
+ getCurrentNavigation() { return this.currentNavigation; }
5243
5366
  /**
5244
5367
  * \@internal
5245
5368
  * @param {?} event
5246
5369
  * @return {?}
5247
5370
  */
5248
- triggerEvent(event) { (/** @type {?} */ (this.events)).next(event); }
5371
+ triggerEvent(event) { ((/** @type {?} */ (this.events))).next(event); }
5249
5372
  /**
5250
5373
  * Resets the configuration used for navigation and generating links.
5251
5374
  *
@@ -5282,7 +5405,7 @@ class Router {
5282
5405
  dispose() {
5283
5406
  if (this.locationSubscription) {
5284
5407
  this.locationSubscription.unsubscribe();
5285
- this.locationSubscription = /** @type {?} */ ((null));
5408
+ this.locationSubscription = (/** @type {?} */ (null));
5286
5409
  }
5287
5410
  }
5288
5411
  /**
@@ -5333,7 +5456,7 @@ class Router {
5333
5456
  */
5334
5457
  createUrlTree(commands, navigationExtras = {}) {
5335
5458
  const { relativeTo, queryParams, fragment, preserveQueryParams, queryParamsHandling, preserveFragment } = navigationExtras;
5336
- if (isDevMode() && preserveQueryParams && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
5459
+ if (isDevMode() && preserveQueryParams && (/** @type {?} */ (console)) && (/** @type {?} */ (console.warn))) {
5337
5460
  console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.');
5338
5461
  }
5339
5462
  /** @type {?} */
@@ -5360,7 +5483,7 @@ class Router {
5360
5483
  if (q !== null) {
5361
5484
  q = this.removeEmptyProps(q);
5362
5485
  }
5363
- return createUrlTree(a, this.currentUrlTree, commands, /** @type {?} */ ((q)), /** @type {?} */ ((f)));
5486
+ return createUrlTree(a, this.currentUrlTree, commands, (/** @type {?} */ (q)), (/** @type {?} */ (f)));
5364
5487
  }
5365
5488
  /**
5366
5489
  * Navigate based on the provided url. This navigation is always absolute.
@@ -5422,6 +5545,11 @@ class Router {
5422
5545
  * The first parameter of `navigate()` is a delta to be applied to the current URL
5423
5546
  * or the one provided in the `relativeTo` property of the second parameter (the
5424
5547
  * `NavigationExtras`).
5548
+ *
5549
+ * In order to affect this browser's `history.state` entry, the `state`
5550
+ * parameter can be passed. This must be an object because the router
5551
+ * will add the `navigationId` property to this object before creating
5552
+ * the new history item.
5425
5553
  * @param {?} commands
5426
5554
  * @param {?=} extras
5427
5555
  * @return {?}
@@ -5467,6 +5595,7 @@ class Router {
5467
5595
  return containsTree(this.currentUrlTree, urlTree, exact);
5468
5596
  }
5469
5597
  /**
5598
+ * @private
5470
5599
  * @param {?} params
5471
5600
  * @return {?}
5472
5601
  */
@@ -5481,25 +5610,29 @@ class Router {
5481
5610
  }, {});
5482
5611
  }
5483
5612
  /**
5613
+ * @private
5484
5614
  * @return {?}
5485
5615
  */
5486
5616
  processNavigations() {
5487
5617
  this.navigations.subscribe(t => {
5488
5618
  this.navigated = true;
5489
5619
  this.lastSuccessfulId = t.id;
5490
- (/** @type {?} */ (this.events))
5620
+ ((/** @type {?} */ (this.events)))
5491
5621
  .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
5622
+ this.lastSuccessfulNavigation = this.currentNavigation;
5623
+ this.currentNavigation = null;
5492
5624
  t.resolve(true);
5493
5625
  }, e => { this.console.warn(`Unhandled Navigation Error: `); });
5494
5626
  }
5495
5627
  /**
5628
+ * @private
5496
5629
  * @param {?} rawUrl
5497
5630
  * @param {?} source
5498
- * @param {?} state
5631
+ * @param {?} restoredState
5499
5632
  * @param {?} extras
5500
5633
  * @return {?}
5501
5634
  */
5502
- scheduleNavigation(rawUrl, source, state, extras) {
5635
+ scheduleNavigation(rawUrl, source, restoredState, extras) {
5503
5636
  /** @type {?} */
5504
5637
  const lastNavigation = this.getTransition();
5505
5638
  // If the user triggers a navigation imperatively (e.g., by using navigateByUrl),
@@ -5537,7 +5670,7 @@ class Router {
5537
5670
  this.setTransition({
5538
5671
  id,
5539
5672
  source,
5540
- state,
5673
+ restoredState,
5541
5674
  currentUrlTree: this.currentUrlTree,
5542
5675
  currentRawUrl: this.rawUrlTree, rawUrl, extras, resolve, reject, promise,
5543
5676
  currentSnapshot: this.routerState.snapshot,
@@ -5548,34 +5681,40 @@ class Router {
5548
5681
  return promise.catch((e) => { return Promise.reject(e); });
5549
5682
  }
5550
5683
  /**
5684
+ * @private
5551
5685
  * @param {?} url
5552
5686
  * @param {?} replaceUrl
5553
5687
  * @param {?} id
5688
+ * @param {?=} state
5554
5689
  * @return {?}
5555
5690
  */
5556
- setBrowserUrl(url, replaceUrl, id) {
5691
+ setBrowserUrl(url, replaceUrl, id, state) {
5557
5692
  /** @type {?} */
5558
5693
  const path = this.urlSerializer.serialize(url);
5694
+ state = state || {};
5559
5695
  if (this.location.isCurrentPathEqualTo(path) || replaceUrl) {
5560
- this.location.replaceState(path, '', { navigationId: id });
5696
+ // TODO(jasonaden): Remove first `navigationId` and rely on `ng` namespace.
5697
+ this.location.replaceState(path, '', Object.assign({}, state, { navigationId: id }));
5561
5698
  }
5562
5699
  else {
5563
- this.location.go(path, '', { navigationId: id });
5700
+ this.location.go(path, '', Object.assign({}, state, { navigationId: id }));
5564
5701
  }
5565
5702
  }
5566
5703
  /**
5704
+ * @private
5567
5705
  * @param {?} storedState
5568
5706
  * @param {?} storedUrl
5569
5707
  * @param {?} rawUrl
5570
5708
  * @return {?}
5571
5709
  */
5572
5710
  resetStateAndUrl(storedState, storedUrl, rawUrl) {
5573
- (/** @type {?} */ (this)).routerState = storedState;
5711
+ ((/** @type {?} */ (this))).routerState = storedState;
5574
5712
  this.currentUrlTree = storedUrl;
5575
5713
  this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl);
5576
5714
  this.resetUrlToCurrentUrlTree();
5577
5715
  }
5578
5716
  /**
5717
+ * @private
5579
5718
  * @return {?}
5580
5719
  */
5581
5720
  resetUrlToCurrentUrlTree() {
@@ -5598,7 +5737,7 @@ function validateCommands(commands) {
5598
5737
 
5599
5738
  /**
5600
5739
  * @fileoverview added by tsickle
5601
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
5740
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5602
5741
  */
5603
5742
  /**
5604
5743
  * \@description
@@ -5660,6 +5799,27 @@ function validateCommands(commands) {
5660
5799
  * </a>
5661
5800
  * ```
5662
5801
  *
5802
+ * You can provide a `state` value to be persisted to the browser's History.state
5803
+ * property (See https://developer.mozilla.org/en-US/docs/Web/API/History#Properties). It's
5804
+ * used as follows:
5805
+ *
5806
+ * ```
5807
+ * <a [routerLink]="['/user/bob']" [state]="{tracingId: 123}">
5808
+ * link to user component
5809
+ * </a>
5810
+ * ```
5811
+ *
5812
+ * And later the value can be read from the router through `router.getCurrentNavigation`.
5813
+ * For example, to capture the `tracingId` above during the `NavigationStart` event:
5814
+ *
5815
+ * ```
5816
+ * // Get NavigationStart events
5817
+ * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => {
5818
+ * const navigation = router.getCurrentNavigation();
5819
+ * tracingService.trace({id: navigation.extras.state.tracingId});
5820
+ * });
5821
+ * ```
5822
+ *
5663
5823
  * The router link directive always treats the provided input as a delta to the current url.
5664
5824
  *
5665
5825
  * For instance, if the current url is `/user/(box//aux:team)`.
@@ -5707,7 +5867,7 @@ class RouterLink {
5707
5867
  * @return {?}
5708
5868
  */
5709
5869
  set preserveQueryParams(value) {
5710
- if (isDevMode() && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
5870
+ if (isDevMode() && (/** @type {?} */ (console)) && (/** @type {?} */ (console.warn))) {
5711
5871
  console.warn('preserveQueryParams is deprecated!, use queryParamsHandling instead.');
5712
5872
  }
5713
5873
  this.preserve = value;
@@ -5756,6 +5916,7 @@ RouterLink.propDecorators = {
5756
5916
  preserveFragment: [{ type: Input }],
5757
5917
  skipLocationChange: [{ type: Input }],
5758
5918
  replaceUrl: [{ type: Input }],
5919
+ state: [{ type: Input }],
5759
5920
  routerLink: [{ type: Input }],
5760
5921
  preserveQueryParams: [{ type: Input }],
5761
5922
  onClick: [{ type: HostListener, args: ['click',] }]
@@ -5805,7 +5966,7 @@ class RouterLinkWithHref {
5805
5966
  * @return {?}
5806
5967
  */
5807
5968
  set preserveQueryParams(value) {
5808
- if (isDevMode() && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
5969
+ if (isDevMode() && (/** @type {?} */ (console)) && (/** @type {?} */ (console.warn))) {
5809
5970
  console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.');
5810
5971
  }
5811
5972
  this.preserve = value;
@@ -5837,11 +5998,13 @@ class RouterLinkWithHref {
5837
5998
  const extras = {
5838
5999
  skipLocationChange: attrBoolValue(this.skipLocationChange),
5839
6000
  replaceUrl: attrBoolValue(this.replaceUrl),
6001
+ state: this.state
5840
6002
  };
5841
6003
  this.router.navigateByUrl(this.urlTree, extras);
5842
6004
  return false;
5843
6005
  }
5844
6006
  /**
6007
+ * @private
5845
6008
  * @return {?}
5846
6009
  */
5847
6010
  updateTargetUrlAndHref() {
@@ -5878,6 +6041,7 @@ RouterLinkWithHref.propDecorators = {
5878
6041
  preserveFragment: [{ type: Input }],
5879
6042
  skipLocationChange: [{ type: Input }],
5880
6043
  replaceUrl: [{ type: Input }],
6044
+ state: [{ type: Input }],
5881
6045
  href: [{ type: HostBinding }],
5882
6046
  routerLink: [{ type: Input }],
5883
6047
  preserveQueryParams: [{ type: Input }],
@@ -5893,7 +6057,7 @@ function attrBoolValue(s) {
5893
6057
 
5894
6058
  /**
5895
6059
  * @fileoverview added by tsickle
5896
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
6060
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5897
6061
  */
5898
6062
  /**
5899
6063
  *
@@ -6000,6 +6164,7 @@ class RouterLinkActive {
6000
6164
  */
6001
6165
  ngOnDestroy() { this.subscription.unsubscribe(); }
6002
6166
  /**
6167
+ * @private
6003
6168
  * @return {?}
6004
6169
  */
6005
6170
  update() {
@@ -6009,7 +6174,7 @@ class RouterLinkActive {
6009
6174
  /** @type {?} */
6010
6175
  const hasActiveLinks = this.hasActiveLinks();
6011
6176
  if (this.isActive !== hasActiveLinks) {
6012
- (/** @type {?} */ (this)).isActive = hasActiveLinks;
6177
+ ((/** @type {?} */ (this))).isActive = hasActiveLinks;
6013
6178
  this.classes.forEach((c) => {
6014
6179
  if (hasActiveLinks) {
6015
6180
  this.renderer.addClass(this.element.nativeElement, c);
@@ -6022,6 +6187,7 @@ class RouterLinkActive {
6022
6187
  });
6023
6188
  }
6024
6189
  /**
6190
+ * @private
6025
6191
  * @param {?} router
6026
6192
  * @return {?}
6027
6193
  */
@@ -6029,6 +6195,7 @@ class RouterLinkActive {
6029
6195
  return (link) => router.isActive(link.urlTree, this.routerLinkActiveOptions.exact);
6030
6196
  }
6031
6197
  /**
6198
+ * @private
6032
6199
  * @return {?}
6033
6200
  */
6034
6201
  hasActiveLinks() {
@@ -6058,7 +6225,7 @@ RouterLinkActive.propDecorators = {
6058
6225
 
6059
6226
  /**
6060
6227
  * @fileoverview added by tsickle
6061
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
6228
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6062
6229
  */
6063
6230
  /**
6064
6231
  * @license
@@ -6088,6 +6255,7 @@ class OutletContext {
6088
6255
  */
6089
6256
  class ChildrenOutletContexts {
6090
6257
  constructor() {
6258
+ // contexts for child outlets, by name.
6091
6259
  this.contexts = new Map();
6092
6260
  }
6093
6261
  /**
@@ -6154,7 +6322,7 @@ class ChildrenOutletContexts {
6154
6322
 
6155
6323
  /**
6156
6324
  * @fileoverview added by tsickle
6157
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
6325
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6158
6326
  */
6159
6327
  /**
6160
6328
  * \@description
@@ -6208,6 +6376,8 @@ class RouterOutlet {
6208
6376
  */
6209
6377
  ngOnInit() {
6210
6378
  if (!this.activated) {
6379
+ // If the outlet was not instantiated at the time the route got activated we need to populate
6380
+ // the outlet when it is initialized (ie inside a NgIf)
6211
6381
  /** @type {?} */
6212
6382
  const context = this.parentContexts.getContext(this.name);
6213
6383
  if (context && context.route) {
@@ -6240,7 +6410,7 @@ class RouterOutlet {
6240
6410
  get activatedRoute() {
6241
6411
  if (!this.activated)
6242
6412
  throw new Error('Outlet is not activated');
6243
- return /** @type {?} */ (this._activatedRoute);
6413
+ return (/** @type {?} */ (this._activatedRoute));
6244
6414
  }
6245
6415
  /**
6246
6416
  * @return {?}
@@ -6302,7 +6472,7 @@ class RouterOutlet {
6302
6472
  /** @type {?} */
6303
6473
  const snapshot = activatedRoute._futureSnapshot;
6304
6474
  /** @type {?} */
6305
- const component = /** @type {?} */ (/** @type {?} */ ((snapshot.routeConfig)).component);
6475
+ const component = (/** @type {?} */ ((/** @type {?} */ (snapshot.routeConfig)).component));
6306
6476
  resolver = resolver || this.resolver;
6307
6477
  /** @type {?} */
6308
6478
  const factory = resolver.resolveComponentFactory(component);
@@ -6361,7 +6531,7 @@ class OutletInjector {
6361
6531
 
6362
6532
  /**
6363
6533
  * @fileoverview added by tsickle
6364
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
6534
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6365
6535
  */
6366
6536
  /**
6367
6537
  * \@description
@@ -6458,11 +6628,15 @@ class RouterPreloader {
6458
6628
  const ngModule = this.injector.get(NgModuleRef);
6459
6629
  return this.processRoutes(ngModule, this.router.config);
6460
6630
  }
6631
+ // TODO(jasonaden): This class relies on code external to the class to call setUpPreloading. If
6632
+ // this hasn't been done, ngOnDestroy will fail as this.subscription will be undefined. This
6633
+ // should be refactored.
6461
6634
  /**
6462
6635
  * @return {?}
6463
6636
  */
6464
6637
  ngOnDestroy() { this.subscription.unsubscribe(); }
6465
6638
  /**
6639
+ * @private
6466
6640
  * @param {?} ngModule
6467
6641
  * @param {?} routes
6468
6642
  * @return {?}
@@ -6489,6 +6663,7 @@ class RouterPreloader {
6489
6663
  return from(res).pipe(mergeAll(), map((_) => void 0));
6490
6664
  }
6491
6665
  /**
6666
+ * @private
6492
6667
  * @param {?} ngModule
6493
6668
  * @param {?} route
6494
6669
  * @return {?}
@@ -6518,7 +6693,7 @@ RouterPreloader.ctorParameters = () => [
6518
6693
 
6519
6694
  /**
6520
6695
  * @fileoverview added by tsickle
6521
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
6696
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6522
6697
  */
6523
6698
  class RouterScroller {
6524
6699
  /**
@@ -6552,6 +6727,7 @@ class RouterScroller {
6552
6727
  this.scrollEventsSubscription = this.consumeScrollEvents();
6553
6728
  }
6554
6729
  /**
6730
+ * @private
6555
6731
  * @return {?}
6556
6732
  */
6557
6733
  createScrollEvents() {
@@ -6569,6 +6745,7 @@ class RouterScroller {
6569
6745
  });
6570
6746
  }
6571
6747
  /**
6748
+ * @private
6572
6749
  * @return {?}
6573
6750
  */
6574
6751
  consumeScrollEvents() {
@@ -6596,6 +6773,7 @@ class RouterScroller {
6596
6773
  });
6597
6774
  }
6598
6775
  /**
6776
+ * @private
6599
6777
  * @param {?} routerEvent
6600
6778
  * @param {?} anchor
6601
6779
  * @return {?}
@@ -6618,27 +6796,30 @@ class RouterScroller {
6618
6796
 
6619
6797
  /**
6620
6798
  * @fileoverview added by tsickle
6621
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
6799
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6622
6800
  */
6623
- /** *
6801
+ /**
6624
6802
  * \@description
6625
6803
  *
6626
6804
  * Contains a list of directives
6627
6805
  *
6628
6806
  *
6629
- @type {?} */
6807
+ * @type {?}
6808
+ */
6630
6809
  const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, EmptyOutletComponent];
6631
- /** *
6810
+ /**
6632
6811
  * \@description
6633
6812
  *
6634
6813
  * Is used in DI to configure the router.
6635
6814
  *
6636
6815
  * \@publicApi
6637
- @type {?} */
6816
+ * @type {?}
6817
+ */
6638
6818
  const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION');
6639
- /** *
6819
+ /**
6640
6820
  * \@docsNotRequired
6641
- @type {?} */
6821
+ * @type {?}
6822
+ */
6642
6823
  const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
6643
6824
  /** @type {?} */
6644
6825
  const ROUTER_PROVIDERS = [
@@ -6719,6 +6900,7 @@ function routerNgProbeToken() {
6719
6900
  * \@publicApi
6720
6901
  */
6721
6902
  class RouterModule {
6903
+ // Note: We are injecting the Router so it gets created eagerly...
6722
6904
  /**
6723
6905
  * @param {?} guard
6724
6906
  * @param {?} router
@@ -6944,7 +7126,7 @@ class RouterInitializer {
6944
7126
  const p = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6945
7127
  return p.then(() => {
6946
7128
  /** @type {?} */
6947
- let resolve = /** @type {?} */ ((null));
7129
+ let resolve = (/** @type {?} */ (null));
6948
7130
  /** @type {?} */
6949
7131
  const res = new Promise(r => resolve = r);
6950
7132
  /** @type {?} */
@@ -6968,7 +7150,7 @@ class RouterInitializer {
6968
7150
  // subsequent navigations should not be delayed
6969
7151
  }
6970
7152
  else {
6971
- return /** @type {?} */ (of(null));
7153
+ return (/** @type {?} */ (of(null)));
6972
7154
  }
6973
7155
  };
6974
7156
  router.initialNavigation();
@@ -7006,10 +7188,11 @@ class RouterInitializer {
7006
7188
  preloader.setUpPreloading();
7007
7189
  routerScroller.init();
7008
7190
  router.resetRootComponentType(ref.componentTypes[0]);
7009
- this.resultOfPreactivationDone.next(/** @type {?} */ ((null)));
7191
+ this.resultOfPreactivationDone.next((/** @type {?} */ (null)));
7010
7192
  this.resultOfPreactivationDone.complete();
7011
7193
  }
7012
7194
  /**
7195
+ * @private
7013
7196
  * @param {?} opts
7014
7197
  * @return {?}
7015
7198
  */
@@ -7018,6 +7201,7 @@ class RouterInitializer {
7018
7201
  opts.initialNavigation === undefined;
7019
7202
  }
7020
7203
  /**
7204
+ * @private
7021
7205
  * @param {?} opts
7022
7206
  * @return {?}
7023
7207
  */
@@ -7046,11 +7230,12 @@ function getAppInitializer(r) {
7046
7230
  function getBootstrapListener(r) {
7047
7231
  return r.bootstrapListener.bind(r);
7048
7232
  }
7049
- /** *
7233
+ /**
7050
7234
  * A token for the router initializer that will be called after the app is bootstrapped.
7051
7235
  *
7052
7236
  * \@publicApi
7053
- @type {?} */
7237
+ * @type {?}
7238
+ */
7054
7239
  const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
7055
7240
  /**
7056
7241
  * @return {?}
@@ -7071,32 +7256,32 @@ function provideRouterInitializer() {
7071
7256
 
7072
7257
  /**
7073
7258
  * @fileoverview added by tsickle
7074
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
7259
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7075
7260
  */
7076
- /** *
7261
+ /**
7077
7262
  * \@publicApi
7078
- @type {?} */
7079
- const VERSION = new Version('7.2.0-beta.0');
7263
+ * @type {?}
7264
+ */
7265
+ const VERSION = new Version('7.2.0');
7080
7266
 
7081
7267
  /**
7082
7268
  * @fileoverview added by tsickle
7083
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
7269
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7084
7270
  */
7085
7271
 
7086
7272
  /**
7087
7273
  * @fileoverview added by tsickle
7088
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
7274
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7089
7275
  */
7090
7276
 
7091
7277
  /**
7092
7278
  * @fileoverview added by tsickle
7093
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
7279
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7094
7280
  */
7095
- // This file only reexports content of the `src` folder. Keep it that way.
7096
7281
 
7097
7282
  /**
7098
7283
  * @fileoverview added by tsickle
7099
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
7284
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7100
7285
  */
7101
7286
 
7102
7287
  /**