@angular/router 10.0.1 → 10.0.5

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v10.0.1
2
+ * @license Angular v10.0.5
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -20,7 +20,7 @@ import { map, concatAll, last as last$1, catchError, first, mergeMap, tap, every
20
20
  * Base for events the router goes through, as opposed to events tied to a specific
21
21
  * route. Fired one time for any given navigation.
22
22
  *
23
- * @usageNotes
23
+ * The following code shows how a class subscribes to router events.
24
24
  *
25
25
  * ```ts
26
26
  * class MyService {
@@ -35,6 +35,7 @@ import { map, concatAll, last as last$1, catchError, first, mergeMap, tap, every
35
35
  * ```
36
36
  *
37
37
  * @see `Event`
38
+ * @see [Router events summary](guide/router#router-events)
38
39
  * @publicApi
39
40
  */
40
41
  class RouterEvent {
@@ -74,6 +75,10 @@ class NavigationStart extends RouterEvent {
74
75
  /**
75
76
  * An event triggered when a navigation ends successfully.
76
77
  *
78
+ * @see `NavigationStart`
79
+ * @see `NavigationCancel`
80
+ * @see `NavigationError`
81
+ *
77
82
  * @publicApi
78
83
  */
79
84
  class NavigationEnd extends RouterEvent {
@@ -94,10 +99,13 @@ class NavigationEnd extends RouterEvent {
94
99
  }
95
100
  /**
96
101
  * An event triggered when a navigation is canceled, directly or indirectly.
97
- *
98
- * This can happen when a [route guard](guide/router#milestone-5-route-guards)
102
+ * This can happen when a route guard
99
103
  * returns `false` or initiates a redirect by returning a `UrlTree`.
100
104
  *
105
+ * @see `NavigationStart`
106
+ * @see `NavigationEnd`
107
+ * @see `NavigationError`
108
+ *
101
109
  * @publicApi
102
110
  */
103
111
  class NavigationCancel extends RouterEvent {
@@ -119,6 +127,10 @@ class NavigationCancel extends RouterEvent {
119
127
  /**
120
128
  * An event triggered when a navigation fails due to an unexpected error.
121
129
  *
130
+ * @see `NavigationStart`
131
+ * @see `NavigationEnd`
132
+ * @see `NavigationCancel`
133
+ *
122
134
  * @publicApi
123
135
  */
124
136
  class NavigationError extends RouterEvent {
@@ -138,7 +150,7 @@ class NavigationError extends RouterEvent {
138
150
  }
139
151
  }
140
152
  /**
141
- *An event triggered when routes are recognized.
153
+ * An event triggered when routes are recognized.
142
154
  *
143
155
  * @publicApi
144
156
  */
@@ -164,6 +176,8 @@ class RoutesRecognized extends RouterEvent {
164
176
  /**
165
177
  * An event triggered at the start of the Guard phase of routing.
166
178
  *
179
+ * @see `GuardsCheckEnd`
180
+ *
167
181
  * @publicApi
168
182
  */
169
183
  class GuardsCheckStart extends RouterEvent {
@@ -187,6 +201,8 @@ class GuardsCheckStart extends RouterEvent {
187
201
  /**
188
202
  * An event triggered at the end of the Guard phase of routing.
189
203
  *
204
+ * @see `GuardsCheckStart`
205
+ *
190
206
  * @publicApi
191
207
  */
192
208
  class GuardsCheckEnd extends RouterEvent {
@@ -216,6 +232,8 @@ class GuardsCheckEnd extends RouterEvent {
216
232
  * Runs in the "resolve" phase whether or not there is anything to resolve.
217
233
  * In future, may change to only run when there are things to be resolved.
218
234
  *
235
+ * @see `ResolveEnd`
236
+ *
219
237
  * @publicApi
220
238
  */
221
239
  class ResolveStart extends RouterEvent {
@@ -263,6 +281,8 @@ class ResolveEnd extends RouterEvent {
263
281
  /**
264
282
  * An event triggered before lazy loading a route configuration.
265
283
  *
284
+ * @see `RouteConfigLoadEnd`
285
+ *
266
286
  * @publicApi
267
287
  */
268
288
  class RouteConfigLoadStart {
@@ -278,6 +298,8 @@ class RouteConfigLoadStart {
278
298
  /**
279
299
  * An event triggered when a route has been lazy loaded.
280
300
  *
301
+ * @see `RouteConfigLoadStart`
302
+ *
281
303
  * @publicApi
282
304
  */
283
305
  class RouteConfigLoadEnd {
@@ -313,7 +335,7 @@ class ChildActivationStart {
313
335
  * An event triggered at the end of the child-activation part
314
336
  * of the Resolve phase of routing.
315
337
  * @see `ChildActivationStart`
316
- * @see `ResolveStart` *
338
+ * @see `ResolveStart`
317
339
  * @publicApi
318
340
  */
319
341
  class ChildActivationEnd {
@@ -330,7 +352,7 @@ class ChildActivationEnd {
330
352
  /**
331
353
  * An event triggered at the start of the activation part
332
354
  * of the Resolve phase of routing.
333
- * @see ActivationEnd`
355
+ * @see `ActivationEnd`
334
356
  * @see `ResolveStart`
335
357
  *
336
358
  * @publicApi
@@ -1371,7 +1393,8 @@ function nodeChildrenAsMap(node) {
1371
1393
  * and the resolved data.
1372
1394
  * Use the `ActivatedRoute` properties to traverse the tree from any node.
1373
1395
  *
1374
- * ### Example
1396
+ * The following fragment shows how a component gets the root node
1397
+ * of the current state to establish its own route tree:
1375
1398
  *
1376
1399
  * ```
1377
1400
  * @Component({templateUrl:'template.html'})
@@ -1387,6 +1410,7 @@ function nodeChildrenAsMap(node) {
1387
1410
  * ```
1388
1411
  *
1389
1412
  * @see `ActivatedRoute`
1413
+ * @see [Getting route information](guide/router#getting-route-information)
1390
1414
  *
1391
1415
  * @publicApi
1392
1416
  */
@@ -1427,9 +1451,14 @@ function createEmptyStateSnapshot(urlTree, rootComponent) {
1427
1451
  * that is loaded in an outlet.
1428
1452
  * Use to traverse the `RouterState` tree and extract information from nodes.
1429
1453
  *
1454
+ * The following example shows how to construct a component using information from a
1455
+ * currently activated route.
1456
+ *
1430
1457
  * {@example router/activated-route/module.ts region="activated-route"
1431
1458
  * header="activated-route.component.ts"}
1432
1459
  *
1460
+ * @see [Getting route information](guide/router#getting-route-information)
1461
+ *
1433
1462
  * @publicApi
1434
1463
  */
1435
1464
  class ActivatedRoute {
@@ -1553,6 +1582,9 @@ function flattenInherited(pathFromRoot) {
1553
1582
  * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to
1554
1583
  * traverse the router state tree.
1555
1584
  *
1585
+ * The following example initializes a component with route information extracted
1586
+ * from the snapshot of the root node at the time of creation.
1587
+ *
1556
1588
  * ```
1557
1589
  * @Component({templateUrl:'./my-component.html'})
1558
1590
  * class MyComponent {
@@ -1641,8 +1673,8 @@ class ActivatedRouteSnapshot {
1641
1673
  * This is a tree of activated route snapshots. Every node in this tree knows about
1642
1674
  * the "consumed" URL segments, the extracted parameters, and the resolved data.
1643
1675
  *
1644
- * @usageNotes
1645
- * ### Example
1676
+ * The following example shows how a component is initialized with information
1677
+ * from the snapshot of the root node's state at the time of creation.
1646
1678
  *
1647
1679
  * ```
1648
1680
  * @Component({templateUrl:'template.html'})
@@ -3546,7 +3578,7 @@ function defaultRouterHook(snapshot, runExtras) {
3546
3578
  /**
3547
3579
  * @description
3548
3580
  *
3549
- * A service that provides navigation and URL manipulation capabilities.
3581
+ * A service that provides navigation among views and URL manipulation capabilities.
3550
3582
  *
3551
3583
  * @see `Route`.
3552
3584
  * @see [Routing and Navigation Guide](guide/router).
@@ -4000,7 +4032,7 @@ class Router {
4000
4032
  this.events.next(event);
4001
4033
  }
4002
4034
  /**
4003
- * Resets the configuration used for navigation and generating links.
4035
+ * Resets the route configuration used for navigation and generating links.
4004
4036
  *
4005
4037
  * @param config The route array for the new configuration.
4006
4038
  *
@@ -4033,14 +4065,15 @@ class Router {
4033
4065
  }
4034
4066
  }
4035
4067
  /**
4036
- * Applies an array of commands to the current URL tree and creates a new URL tree.
4068
+ * Appends URL segments to the current URL tree to create a new URL tree.
4037
4069
  *
4038
- * When given an activated route, applies the given commands starting from the route.
4039
- * Otherwise, applies the given command starting from the root.
4040
- *
4041
- * @param commands An array of commands to apply.
4070
+ * @param commands An array of URL fragments with which to construct the new URL tree.
4071
+ * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
4072
+ * segments, followed by the parameters for each segment.
4073
+ * The fragments are applied to the current URL tree or the one provided in the `relativeTo`
4074
+ * property of the options object, if supplied.
4042
4075
  * @param navigationExtras Options that control the navigation strategy. This function
4043
- * only utilizes properties in `NavigationExtras` that would change the provided URL.
4076
+ * only uses properties in `NavigationExtras` that would change the provided URL.
4044
4077
  * @returns The new URL tree.
4045
4078
  *
4046
4079
  * @usageNotes
@@ -4106,9 +4139,10 @@ class Router {
4106
4139
  return createUrlTree(a, this.currentUrlTree, commands, q, f);
4107
4140
  }
4108
4141
  /**
4109
- * Navigate based on the provided URL, which must be absolute.
4142
+ * Navigates to a view using an absolute route path.
4110
4143
  *
4111
- * @param url An absolute URL. The function does not apply any delta to the current URL.
4144
+ * @param url An absolute path for a defined route. The function does not apply any delta to the
4145
+ * current URL.
4112
4146
  * @param extras An object containing properties that modify the navigation strategy.
4113
4147
  * The function ignores any properties in the `NavigationExtras` that would change the
4114
4148
  * provided URL.
@@ -4118,6 +4152,8 @@ class Router {
4118
4152
  *
4119
4153
  * @usageNotes
4120
4154
  *
4155
+ * The following calls request navigation to an absolute path.
4156
+ *
4121
4157
  * ```
4122
4158
  * router.navigateByUrl("/team/33/user/11");
4123
4159
  *
@@ -4125,6 +4161,8 @@ class Router {
4125
4161
  * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
4126
4162
  * ```
4127
4163
  *
4164
+ * @see [Routing and Navigation guide](guide/router)
4165
+ *
4128
4166
  */
4129
4167
  navigateByUrl(url, extras = { skipLocationChange: false }) {
4130
4168
  if (isDevMode() && this.isNgZoneEnabled && !NgZone.isInAngularZone()) {
@@ -4138,28 +4176,31 @@ class Router {
4138
4176
  * Navigate based on the provided array of commands and a starting point.
4139
4177
  * If no starting route is provided, the navigation is absolute.
4140
4178
  *
4141
- * Returns a promise that:
4142
- * - resolves to 'true' when navigation succeeds,
4143
- * - resolves to 'false' when navigation fails,
4144
- * - is rejected when an error happens.
4179
+ * @param commands An array of URL fragments with which to construct the target URL.
4180
+ * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
4181
+ * segments, followed by the parameters for each segment.
4182
+ * The fragments are applied to the current URL or the one provided in the `relativeTo` property
4183
+ * of the options object, if supplied.
4184
+ * @param extras An options object that determines how the URL should be constructed or
4185
+ * interpreted.
4186
+ *
4187
+ * @returns A Promise that resolves to `true` when navigation succeeds, to `false` when navigation
4188
+ * fails,
4189
+ * or is rejected on error.
4145
4190
  *
4146
4191
  * @usageNotes
4147
4192
  *
4193
+ * The following calls request navigation to a dynamic route path relative to the current URL.
4194
+ *
4148
4195
  * ```
4149
4196
  * router.navigate(['team', 33, 'user', 11], {relativeTo: route});
4150
4197
  *
4151
- * // Navigate without updating the URL
4198
+ * // Navigate without updating the URL, overriding the default behavior
4152
4199
  * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});
4153
4200
  * ```
4154
4201
  *
4155
- * The first parameter of `navigate()` is a delta to be applied to the current URL
4156
- * or the one provided in the `relativeTo` property of the second parameter (the
4157
- * `NavigationExtras`).
4202
+ * @see [Routing and Navigation guide](guide/router)
4158
4203
  *
4159
- * In order to affect this browser's `history.state` entry, the `state`
4160
- * parameter can be passed. This must be an object because the router
4161
- * will add the `navigationId` property to this object before creating
4162
- * the new history item.
4163
4204
  */
4164
4205
  navigate(commands, extras = { skipLocationChange: false }) {
4165
4206
  validateCommands(commands);
@@ -4422,8 +4463,7 @@ class RouterLink {
4422
4463
  }
4423
4464
  }
4424
4465
  /**
4425
- * @param commands An array of commands to pass to {@link Router#createUrlTree
4426
- * Router#createUrlTree}.
4466
+ * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4427
4467
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4428
4468
  * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
4429
4469
  * - **null|undefined**: shorthand for an empty array of commands, i.e. `[]`
@@ -4512,8 +4552,7 @@ class RouterLinkWithHref {
4512
4552
  });
4513
4553
  }
4514
4554
  /**
4515
- * @param commands An array of commands to pass to {@link Router#createUrlTree
4516
- * Router#createUrlTree}.
4555
+ * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4517
4556
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
4518
4557
  * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
4519
4558
  * - **null|undefined**: shorthand for an empty array of commands, i.e. `[]`
@@ -5165,53 +5204,23 @@ function routerNgProbeToken() {
5165
5204
  return new NgProbeToken('Router', Router);
5166
5205
  }
5167
5206
  /**
5168
- * @usageNotes
5169
- *
5170
- * RouterModule can be imported multiple times: once per lazily-loaded bundle.
5171
- * Since the router deals with a global shared resource--location, we cannot have
5172
- * more than one router service active.
5173
- *
5174
- * That is why there are two ways to create the module: `RouterModule.forRoot` and
5175
- * `RouterModule.forChild`.
5176
- *
5177
- * * `forRoot` creates a module that contains all the directives, the given routes, and the router
5178
- * service itself.
5179
- * * `forChild` creates a module that contains all the directives and the given routes, but does not
5180
- * include the router service.
5181
- *
5182
- * When registered at the root, the module should be used as follows
5183
- *
5184
- * ```
5185
- * @NgModule({
5186
- * imports: [RouterModule.forRoot(ROUTES)]
5187
- * })
5188
- * class MyNgModule {}
5189
- * ```
5190
- *
5191
- * For submodules and lazy loaded submodules the module should be used as follows:
5192
- *
5193
- * ```
5194
- * @NgModule({
5195
- * imports: [RouterModule.forChild(ROUTES)]
5196
- * })
5197
- * class MyNgModule {}
5198
- * ```
5199
- *
5200
5207
  * @description
5201
5208
  *
5202
- * Adds router directives and providers.
5209
+ * Adds directives and providers for in-app navigation among views defined in an application.
5210
+ * Use the Angular `Router` service to declaratively specify application states and manage state
5211
+ * transitions.
5203
5212
  *
5204
- * Managing state transitions is one of the hardest parts of building applications. This is
5205
- * especially true on the web, where you also need to ensure that the state is reflected in the URL.
5206
- * In addition, we often want to split applications into multiple bundles and load them on demand.
5207
- * Doing this transparently is not trivial.
5213
+ * You can import this NgModule multiple times, once for each lazy-loaded bundle.
5214
+ * However, only one `Router` service can be active.
5215
+ * To ensure this, there are two ways to register routes when importing this module:
5208
5216
  *
5209
- * The Angular router service solves these problems. Using the router, you can declaratively specify
5210
- * application states, manage state transitions while taking care of the URL, and load bundles on
5211
- * demand.
5217
+ * * The `forRoot()` method creates an `NgModule` that contains all the directives, the given
5218
+ * routes, and the `Router` service itself.
5219
+ * * The `forChild()` method creates an `NgModule` that contains all the directives and the given
5220
+ * routes, but does not include the `Router` service.
5212
5221
  *
5213
- * @see [Routing and Navigation](guide/router.html) for an
5214
- * overview of how the router service should be used.
5222
+ * @see [Routing and Navigation guide](guide/router) for an
5223
+ * overview of how the `Router` service should be used.
5215
5224
  *
5216
5225
  * @publicApi
5217
5226
  */
@@ -5222,9 +5231,19 @@ class RouterModule {
5222
5231
  * Creates and configures a module with all the router providers and directives.
5223
5232
  * Optionally sets up an application listener to perform an initial navigation.
5224
5233
  *
5234
+ * When registering the NgModule at the root, import as follows:
5235
+ *
5236
+ * ```
5237
+ * @NgModule({
5238
+ * imports: [RouterModule.forRoot(ROUTES)]
5239
+ * })
5240
+ * class MyNgModule {}
5241
+ * ```
5242
+ *
5225
5243
  * @param routes An array of `Route` objects that define the navigation paths for the application.
5226
5244
  * @param config An `ExtraOptions` configuration object that controls how navigation is performed.
5227
- * @return The new router module.
5245
+ * @return The new `NgModule`.
5246
+ *
5228
5247
  */
5229
5248
  static forRoot(routes, config) {
5230
5249
  return {
@@ -5259,7 +5278,20 @@ class RouterModule {
5259
5278
  };
5260
5279
  }
5261
5280
  /**
5262
- * Creates a module with all the router directives and a provider registering routes.
5281
+ * Creates a module with all the router directives and a provider registering routes,
5282
+ * without creating a new Router service.
5283
+ * When registering for submodules and lazy-loaded submodules, create the NgModule as follows:
5284
+ *
5285
+ * ```
5286
+ * @NgModule({
5287
+ * imports: [RouterModule.forChild(ROUTES)]
5288
+ * })
5289
+ * class MyNgModule {}
5290
+ * ```
5291
+ *
5292
+ * @param routes An array of `Route` objects that define the navigation paths for the submodule.
5293
+ * @return The new NgModule.
5294
+ *
5263
5295
  */
5264
5296
  static forChild(routes) {
5265
5297
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
@@ -5478,7 +5510,7 @@ function provideRouterInitializer() {
5478
5510
  /**
5479
5511
  * @publicApi
5480
5512
  */
5481
- const VERSION = new Version('10.0.1');
5513
+ const VERSION = new Version('10.0.5');
5482
5514
 
5483
5515
  /**
5484
5516
  * @license