@angular/router 19.2.4 → 19.2.6

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.
package/index.d.ts CHANGED
@@ -1,3685 +1,113 @@
1
1
  /**
2
- * @license Angular v19.2.4
2
+ * @license Angular v19.2.6
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
+ import { ActivatedRouteSnapshot, Params, UrlTree, RouterOutletContract, ActivatedRoute, RouterStateSnapshot, Route, LoadedRouterConfig, Router, Routes, InMemoryScrollingOptions, NavigationError, RedirectCommand, RouterConfigOptions, CanActivate, CanActivateFn, CanActivateChild, CanActivateChildFn, CanDeactivate, CanDeactivateFn, CanMatch, CanMatchFn, Resolve, ResolveFn, Event } from './router_module.d-BivBj8FC.js';
8
+ export { ActivationEnd, ActivationStart, BaseRouteReuseStrategy, CanLoad, CanLoadFn, ChildActivationEnd, ChildActivationStart, Data, DefaultExport, DefaultUrlSerializer, DeprecatedGuard, DetachedRouteHandle, EventType, ExtraOptions, GuardResult, GuardsCheckEnd, GuardsCheckStart, InitialNavigation, IsActiveMatchOptions, LoadChildren, LoadChildrenCallback, MaybeAsync, Navigation, NavigationBehaviorOptions, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationExtras, NavigationSkipped, NavigationSkippedCode, NavigationStart, OnSameUrlNavigation, PRIMARY_OUTLET, ParamMap, QueryParamsHandling, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, RedirectFunction, ResolveData, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterState, RoutesRecognized, RunGuardsAndResolvers, Scroll, UrlCreationOptions, UrlMatchResult, UrlMatcher, UrlSegment, UrlSegmentGroup, UrlSerializer, convertToParamMap, defaultUrlMatcher, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, RestoredState as ɵRestoredState } from './router_module.d-BivBj8FC.js';
9
+ import { Title } from '@angular/platform-browser';
7
10
  import * as i0 from '@angular/core';
8
- import { Type, ProviderToken, NgModuleFactory, Provider, EnvironmentProviders, EnvironmentInjector, OnDestroy, OnInit, ComponentRef, EventEmitter, SimpleChanges, InjectionToken, Signal, OnChanges, Renderer2, ElementRef, AfterContentInit, QueryList, ChangeDetectorRef, Injector, Compiler, ModuleWithProviders, Version } from '@angular/core';
11
+ import { EnvironmentInjector, ComponentRef, InjectionToken, Type, Injector, Compiler, OnDestroy, Provider, EnvironmentProviders, Version } from '@angular/core';
9
12
  import { Observable } from 'rxjs';
10
- import { LocationStrategy } from '@angular/common';
11
- import * as _angular_router from '@angular/router';
12
- import { Title } from '@angular/platform-browser';
13
-
14
- /**
15
- * The primary routing outlet.
16
- *
17
- * @publicApi
18
- */
19
- declare const PRIMARY_OUTLET = "primary";
20
- /**
21
- * A collection of matrix and query URL parameters.
22
- * @see {@link convertToParamMap}
23
- * @see {@link ParamMap}
24
- *
25
- * @publicApi
26
- */
27
- type Params = {
28
- [key: string]: any;
29
- };
30
- /**
31
- * A map that provides access to the required and optional parameters
32
- * specific to a route.
33
- * The map supports retrieving a single value with `get()`
34
- * or multiple values with `getAll()`.
35
- *
36
- * @see [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
37
- *
38
- * @publicApi
39
- */
40
- interface ParamMap {
41
- /**
42
- * Reports whether the map contains a given parameter.
43
- * @param name The parameter name.
44
- * @returns True if the map contains the given parameter, false otherwise.
45
- */
46
- has(name: string): boolean;
47
- /**
48
- * Retrieves a single value for a parameter.
49
- * @param name The parameter name.
50
- * @return The parameter's single value,
51
- * or the first value if the parameter has multiple values,
52
- * or `null` when there is no such parameter.
53
- */
54
- get(name: string): string | null;
55
- /**
56
- * Retrieves multiple values for a parameter.
57
- * @param name The parameter name.
58
- * @return An array containing one or more values,
59
- * or an empty array if there is no such parameter.
60
- *
61
- */
62
- getAll(name: string): string[];
63
- /** Names of the parameters in the map. */
64
- readonly keys: string[];
65
- }
66
- /**
67
- * Converts a `Params` instance to a `ParamMap`.
68
- * @param params The instance to convert.
69
- * @returns The new map instance.
70
- *
71
- * @publicApi
72
- */
73
- declare function convertToParamMap(params: Params): ParamMap;
74
- /**
75
- * Matches the route configuration (`route`) against the actual URL (`segments`).
76
- *
77
- * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.
78
- *
79
- * @param segments The remaining unmatched segments in the current navigation
80
- * @param segmentGroup The current segment group being matched
81
- * @param route The `Route` to match against.
82
- *
83
- * @see {@link UrlMatchResult}
84
- * @see {@link Route}
85
- *
86
- * @returns The resulting match information or `null` if the `route` should not match.
87
- * @publicApi
88
- */
89
- declare function defaultUrlMatcher(segments: UrlSegment[], segmentGroup: UrlSegmentGroup, route: Route): UrlMatchResult | null;
90
-
91
- /**
92
- * A set of options which specify how to determine if a `UrlTree` is active, given the `UrlTree`
93
- * for the current router state.
94
- *
95
- * @publicApi
96
- * @see {@link Router#isActive}
97
- */
98
- interface IsActiveMatchOptions {
99
- /**
100
- * Defines the strategy for comparing the matrix parameters of two `UrlTree`s.
101
- *
102
- * The matrix parameter matching is dependent on the strategy for matching the
103
- * segments. That is, if the `paths` option is set to `'subset'`, only
104
- * the matrix parameters of the matching segments will be compared.
105
- *
106
- * - `'exact'`: Requires that matching segments also have exact matrix parameter
107
- * matches.
108
- * - `'subset'`: The matching segments in the router's active `UrlTree` may contain
109
- * extra matrix parameters, but those that exist in the `UrlTree` in question must match.
110
- * - `'ignored'`: When comparing `UrlTree`s, matrix params will be ignored.
111
- */
112
- matrixParams: 'exact' | 'subset' | 'ignored';
113
- /**
114
- * Defines the strategy for comparing the query parameters of two `UrlTree`s.
115
- *
116
- * - `'exact'`: the query parameters must match exactly.
117
- * - `'subset'`: the active `UrlTree` may contain extra parameters,
118
- * but must match the key and value of any that exist in the `UrlTree` in question.
119
- * - `'ignored'`: When comparing `UrlTree`s, query params will be ignored.
120
- */
121
- queryParams: 'exact' | 'subset' | 'ignored';
122
- /**
123
- * Defines the strategy for comparing the `UrlSegment`s of the `UrlTree`s.
124
- *
125
- * - `'exact'`: all segments in each `UrlTree` must match.
126
- * - `'subset'`: a `UrlTree` will be determined to be active if it
127
- * is a subtree of the active route. That is, the active route may contain extra
128
- * segments, but must at least have all the segments of the `UrlTree` in question.
129
- */
130
- paths: 'exact' | 'subset';
131
- /**
132
- * - `'exact'`: indicates that the `UrlTree` fragments must be equal.
133
- * - `'ignored'`: the fragments will not be compared when determining if a
134
- * `UrlTree` is active.
135
- */
136
- fragment: 'exact' | 'ignored';
137
- }
138
- /**
139
- * @description
140
- *
141
- * Represents the parsed URL.
142
- *
143
- * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a
144
- * serialized tree.
145
- * UrlTree is a data structure that provides a lot of affordances in dealing with URLs
146
- *
147
- * @usageNotes
148
- * ### Example
149
- *
150
- * ```ts
151
- * @Component({templateUrl:'template.html'})
152
- * class MyComponent {
153
- * constructor(router: Router) {
154
- * const tree: UrlTree =
155
- * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');
156
- * const f = tree.fragment; // return 'fragment'
157
- * const q = tree.queryParams; // returns {debug: 'true'}
158
- * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
159
- * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'
160
- * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'
161
- * g.children['support'].segments; // return 1 segment 'help'
162
- * }
163
- * }
164
- * ```
165
- *
166
- * @publicApi
167
- */
168
- declare class UrlTree {
169
- /** The root segment group of the URL tree */
170
- root: UrlSegmentGroup;
171
- /** The query params of the URL */
172
- queryParams: Params;
173
- /** The fragment of the URL */
174
- fragment: string | null;
175
- constructor(
176
- /** The root segment group of the URL tree */
177
- root?: UrlSegmentGroup,
178
- /** The query params of the URL */
179
- queryParams?: Params,
180
- /** The fragment of the URL */
181
- fragment?: string | null);
182
- get queryParamMap(): ParamMap;
183
- /** @docsNotRequired */
184
- toString(): string;
185
- }
186
- /**
187
- * @description
188
- *
189
- * Represents the parsed URL segment group.
190
- *
191
- * See `UrlTree` for more information.
192
- *
193
- * @publicApi
194
- */
195
- declare class UrlSegmentGroup {
196
- /** The URL segments of this group. See `UrlSegment` for more information */
197
- segments: UrlSegment[];
198
- /** The list of children of this group */
199
- children: {
200
- [key: string]: UrlSegmentGroup;
201
- };
202
- /** The parent node in the url tree */
203
- parent: UrlSegmentGroup | null;
204
- constructor(
205
- /** The URL segments of this group. See `UrlSegment` for more information */
206
- segments: UrlSegment[],
207
- /** The list of children of this group */
208
- children: {
209
- [key: string]: UrlSegmentGroup;
210
- });
211
- /** Whether the segment has child segments */
212
- hasChildren(): boolean;
213
- /** Number of child segments */
214
- get numberOfChildren(): number;
215
- /** @docsNotRequired */
216
- toString(): string;
217
- }
218
- /**
219
- * @description
220
- *
221
- * Represents a single URL segment.
222
- *
223
- * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix
224
- * parameters associated with the segment.
225
- *
226
- * @usageNotes
227
- * ### Example
228
- *
229
- * ```ts
230
- * @Component({templateUrl:'template.html'})
231
- * class MyComponent {
232
- * constructor(router: Router) {
233
- * const tree: UrlTree = router.parseUrl('/team;id=33');
234
- * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
235
- * const s: UrlSegment[] = g.segments;
236
- * s[0].path; // returns 'team'
237
- * s[0].parameters; // returns {id: 33}
238
- * }
239
- * }
240
- * ```
241
- *
242
- * @publicApi
243
- */
244
- declare class UrlSegment {
245
- /** The path part of a URL segment */
246
- path: string;
247
- /** The matrix parameters associated with a segment */
248
- parameters: {
249
- [name: string]: string;
250
- };
251
- constructor(
252
- /** The path part of a URL segment */
253
- path: string,
254
- /** The matrix parameters associated with a segment */
255
- parameters: {
256
- [name: string]: string;
257
- });
258
- get parameterMap(): ParamMap;
259
- /** @docsNotRequired */
260
- toString(): string;
261
- }
262
- /**
263
- * @description
264
- *
265
- * Serializes and deserializes a URL string into a URL tree.
266
- *
267
- * The url serialization strategy is customizable. You can
268
- * make all URLs case insensitive by providing a custom UrlSerializer.
269
- *
270
- * See `DefaultUrlSerializer` for an example of a URL serializer.
271
- *
272
- * @publicApi
273
- */
274
- declare abstract class UrlSerializer {
275
- /** Parse a url into a `UrlTree` */
276
- abstract parse(url: string): UrlTree;
277
- /** Converts a `UrlTree` into a url */
278
- abstract serialize(tree: UrlTree): string;
279
- static ɵfac: i0.ɵɵFactoryDeclaration<UrlSerializer, never>;
280
- static ɵprov: i0.ɵɵInjectableDeclaration<UrlSerializer>;
281
- }
282
- /**
283
- * @description
284
- *
285
- * A default implementation of the `UrlSerializer`.
286
- *
287
- * Example URLs:
288
- *
289
- * ```
290
- * /inbox/33(popup:compose)
291
- * /inbox/33;open=true/messages/44
292
- * ```
293
- *
294
- * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the
295
- * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to
296
- * specify route specific parameters.
297
- *
298
- * @publicApi
299
- */
300
- declare class DefaultUrlSerializer implements UrlSerializer {
301
- /** Parses a url into a `UrlTree` */
302
- parse(url: string): UrlTree;
303
- /** Converts a `UrlTree` into a url */
304
- serialize(tree: UrlTree): string;
305
- }
13
+ import '@angular/common';
14
+ import '@angular/router';
306
15
 
307
16
  /**
308
- * How to handle a navigation request to the current URL. One of:
309
- *
310
- * - `'ignore'` : The router ignores the request if it is the same as the current state.
311
- * - `'reload'` : The router processes the URL even if it is not different from the current state.
312
- * One example of when you might want to use this option is if a `canMatch` guard depends on the
313
- * application state and initially rejects navigation to a route. After fixing the state, you want
314
- * to re-navigate to the same URL so that the route with the `canMatch` guard can activate.
315
- *
316
- * Note that this only configures whether or not the Route reprocesses the URL and triggers related
317
- * actions and events like redirects, guards, and resolvers. By default, the router re-uses a
318
- * component instance when it re-navigates to the same component type without visiting a different
319
- * component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
320
- * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
321
- * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`. Additionally,
322
- * resolvers and most guards for routes do not run unless the path or path params have changed
323
- * (configured by `runGuardsAndResolvers`).
324
- *
325
- * @publicApi
326
- * @see {@link RouteReuseStrategy}
327
- * @see {@link RunGuardsAndResolvers}
328
- * @see {@link NavigationBehaviorOptions}
329
- * @see {@link RouterConfigOptions}
330
- */
331
- type OnSameUrlNavigation = 'reload' | 'ignore';
332
- /**
333
- * The `InjectionToken` and `@Injectable` classes for guards and resolvers are deprecated in favor
334
- * of plain JavaScript functions instead. Dependency injection can still be achieved using the
335
- * [`inject`](api/core/inject) function from `@angular/core` and an injectable class can be used as
336
- * a functional guard using [`inject`](api/core/inject): `canActivate: [() =>
337
- * inject(myGuard).canActivate()]`.
338
- *
339
- * @deprecated
340
- * @see {@link CanMatchFn}
341
- * @see {@link CanLoadFn}
342
- * @see {@link CanActivateFn}
343
- * @see {@link CanActivateChildFn}
344
- * @see {@link CanDeactivateFn}
345
- * @see {@link ResolveFn}
346
- * @see {@link /api/core/inject inject}
347
- * @publicApi
348
- */
349
- type DeprecatedGuard = ProviderToken<any> | any;
350
- /**
351
- * The supported types that can be returned from a `Router` guard.
352
- *
353
- * @see [Routing guide](guide/routing/common-router-tasks#preventing-unauthorized-access)
354
- * @publicApi
355
- */
356
- type GuardResult = boolean | UrlTree | RedirectCommand;
357
- /**
358
- * Can be returned by a `Router` guard to instruct the `Router` to redirect rather than continue
359
- * processing the path of the in-flight navigation. The `redirectTo` indicates _where_ the new
360
- * navigation should go to and the optional `navigationBehaviorOptions` can provide more information
361
- * about _how_ to perform the navigation.
362
- *
363
- * ```ts
364
- * const route: Route = {
365
- * path: "user/:userId",
366
- * component: User,
367
- * canActivate: [
368
- * () => {
369
- * const router = inject(Router);
370
- * const authService = inject(AuthenticationService);
371
- *
372
- * if (!authService.isLoggedIn()) {
373
- * const loginPath = router.parseUrl("/login");
374
- * return new RedirectCommand(loginPath, {
375
- * skipLocationChange: "true",
376
- * });
377
- * }
378
- *
379
- * return true;
380
- * },
381
- * ],
382
- * };
383
- * ```
384
- * @see [Routing guide](guide/routing/common-router-tasks#preventing-unauthorized-access)
385
- *
386
- * @publicApi
387
- */
388
- declare class RedirectCommand {
389
- readonly redirectTo: UrlTree;
390
- readonly navigationBehaviorOptions?: NavigationBehaviorOptions | undefined;
391
- constructor(redirectTo: UrlTree, navigationBehaviorOptions?: NavigationBehaviorOptions | undefined);
392
- }
393
- /**
394
- * Type used to represent a value which may be synchronous or async.
395
- *
396
- * @publicApi
397
- */
398
- type MaybeAsync<T> = T | Observable<T> | Promise<T>;
399
- /**
400
- * Represents a route configuration for the Router service.
401
- * An array of `Route` objects, used in `Router.config` and for nested route configurations
402
- * in `Route.children`.
403
- *
404
- * @see {@link Route}
405
- * @see {@link Router}
406
- * @see [Router configuration guide](guide/routing/router-reference#configuration)
407
- * @publicApi
408
- */
409
- type Routes = Route[];
410
- /**
411
- * Represents the result of matching URLs with a custom matching function.
412
- *
413
- * * `consumed` is an array of the consumed URL segments.
414
- * * `posParams` is a map of positional parameters.
415
- *
416
- * @see {@link UrlMatcher}
417
- * @publicApi
418
- */
419
- type UrlMatchResult = {
420
- consumed: UrlSegment[];
421
- posParams?: {
422
- [name: string]: UrlSegment;
423
- };
424
- };
425
- /**
426
- * A function for matching a route against URLs. Implement a custom URL matcher
427
- * for `Route.matcher` when a combination of `path` and `pathMatch`
428
- * is not expressive enough. Cannot be used together with `path` and `pathMatch`.
429
- *
430
- * The function takes the following arguments and returns a `UrlMatchResult` object.
431
- * * *segments* : An array of URL segments.
432
- * * *group* : A segment group.
433
- * * *route* : The route to match against.
434
- *
435
- * The following example implementation matches HTML files.
436
- *
437
- * ```ts
438
- * export function htmlFiles(url: UrlSegment[]) {
439
- * return url.length === 1 && url[0].path.endsWith('.html') ? ({consumed: url}) : null;
440
- * }
441
- *
442
- * export const routes = [{ matcher: htmlFiles, component: AnyComponent }];
443
- * ```
444
- *
445
- * @publicApi
446
- */
447
- type UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: Route) => UrlMatchResult | null;
448
- /**
449
- *
450
- * Represents static data associated with a particular route.
451
- *
452
- * @see {@link Route#data}
453
- *
454
- * @publicApi
455
- */
456
- type Data = {
457
- [key: string | symbol]: any;
458
- };
459
- /**
460
- *
461
- * Represents the resolved data associated with a particular route.
462
- *
463
- * Returning a `RedirectCommand` directs the router to cancel the current navigation and redirect to
464
- * the location provided in the `RedirectCommand`. Note that there are no ordering guarantees when
465
- * resolvers execute. If multiple resolvers would return a `RedirectCommand`, only the first one
466
- * returned will be used.
467
- *
468
- * @see {@link Route#resolve}
469
- *
470
- * @publicApi
471
- */
472
- type ResolveData = {
473
- [key: string | symbol]: ResolveFn<unknown> | DeprecatedGuard;
474
- };
475
- /**
476
- * An ES Module object with a default export of the given type.
477
- *
478
- * @see {@link Route#loadComponent}
479
- * @see {@link LoadChildrenCallback}
480
- *
481
- * @publicApi
482
- */
483
- interface DefaultExport<T> {
484
- /**
485
- * Default exports are bound under the name `"default"`, per the ES Module spec:
486
- * https://tc39.es/ecma262/#table-export-forms-mapping-to-exportentry-records
487
- */
488
- default: T;
489
- }
490
- /**
491
- *
492
- * A function that is called to resolve a collection of lazy-loaded routes.
493
- * Must be an arrow function of the following form:
494
- * `() => import('...').then(mod => mod.MODULE)`
495
- * or
496
- * `() => import('...').then(mod => mod.ROUTES)`
497
- *
498
- * For example:
499
- *
500
- * ```ts
501
- * [{
502
- * path: 'lazy',
503
- * loadChildren: () => import('./lazy-route/lazy.module').then(mod => mod.LazyModule),
504
- * }];
505
- * ```
506
- * or
507
- * ```ts
508
- * [{
509
- * path: 'lazy',
510
- * loadChildren: () => import('./lazy-route/lazy.routes').then(mod => mod.ROUTES),
511
- * }];
512
- * ```
513
- *
514
- * If the lazy-loaded routes are exported via a `default` export, the `.then` can be omitted:
515
- * ```ts
516
- * [{
517
- * path: 'lazy',
518
- * loadChildren: () => import('./lazy-route/lazy.routes'),
519
- * }];
520
- * ```
521
- *
522
- * @see {@link Route#loadChildren}
523
- * @publicApi
524
- */
525
- type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Routes | Observable<Type<any> | Routes | DefaultExport<Type<any>> | DefaultExport<Routes>> | Promise<NgModuleFactory<any> | Type<any> | Routes | DefaultExport<Type<any>> | DefaultExport<Routes>>;
526
- /**
527
- *
528
- * A function that returns a set of routes to load.
529
- *
530
- * @see {@link LoadChildrenCallback}
531
- * @publicApi
532
- */
533
- type LoadChildren = LoadChildrenCallback;
534
- /**
535
- *
536
- * How to handle query parameters in a router link.
537
- * One of:
538
- * - `"merge"` : Merge new parameters with current parameters.
539
- * - `"preserve"` : Preserve current parameters.
540
- * - `"replace"` : Replace current parameters with new parameters. This is the default behavior.
541
- * - `""` : For legacy reasons, the same as `'replace'`.
542
- *
543
- * @see {@link UrlCreationOptions#queryParamsHandling}
544
- * @see {@link RouterLink}
545
- * @publicApi
546
- */
547
- type QueryParamsHandling = 'merge' | 'preserve' | 'replace' | '';
548
- /**
549
- * The type for the function that can be used to handle redirects when the path matches a `Route` config.
550
- *
551
- * The `RedirectFunction` does have access to the full
552
- * `ActivatedRouteSnapshot` interface. Some data are not accurately known
553
- * at the route matching phase. For example, resolvers are not run until
554
- * later, so any resolved title would not be populated. The same goes for lazy
555
- * loaded components. This is also true for all the snapshots up to the
556
- * root, so properties that include parents (root, parent, pathFromRoot)
557
- * are also excluded. And naturally, the full route matching hasn't yet
558
- * happened so firstChild and children are not available either.
559
- *
560
- * @see {@link Route#redirectTo}
561
- * @publicApi
562
- */
563
- type RedirectFunction = (redirectData: Pick<ActivatedRouteSnapshot, 'routeConfig' | 'url' | 'params' | 'queryParams' | 'fragment' | 'data' | 'outlet' | 'title'>) => string | UrlTree;
564
- /**
565
- * A policy for when to run guards and resolvers on a route.
566
- *
567
- * Guards and/or resolvers will always run when a route is activated or deactivated. When a route is
568
- * unchanged, the default behavior is the same as `paramsChange`.
569
- *
570
- * `paramsChange` : Rerun the guards and resolvers when path or
571
- * path param changes. This does not include query parameters. This option is the default.
572
- * - `always` : Run on every execution.
573
- * - `pathParamsChange` : Rerun guards and resolvers when the path params
574
- * change. This does not compare matrix or query parameters.
575
- * - `paramsOrQueryParamsChange` : Run when path, matrix, or query parameters change.
576
- * - `pathParamsOrQueryParamsChange` : Rerun guards and resolvers when the path params
577
- * change or query params have changed. This does not include matrix parameters.
17
+ * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
578
18
  *
579
- * @see {@link Route#runGuardsAndResolvers}
580
19
  * @publicApi
581
- */
582
- type RunGuardsAndResolvers = 'pathParamsChange' | 'pathParamsOrQueryParamsChange' | 'paramsChange' | 'paramsOrQueryParamsChange' | 'always' | ((from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => boolean);
583
- /**
584
- * A configuration object that defines a single route.
585
- * A set of routes are collected in a `Routes` array to define a `Router` configuration.
586
- * The router attempts to match segments of a given URL against each route,
587
- * using the configuration options defined in this object.
588
- *
589
- * Supports static, parameterized, redirect, and wildcard routes, as well as
590
- * custom route data and resolve methods.
591
- *
592
- * For detailed usage information, see the [Routing Guide](guide/routing/common-router-tasks).
593
- *
594
- * @usageNotes
595
- *
596
- * ### Simple Configuration
597
- *
598
- * The following route specifies that when navigating to, for example,
599
- * `/team/11/user/bob`, the router creates the 'Team' component
600
- * with the 'User' child component in it.
601
- *
602
- * ```ts
603
- * [{
604
- * path: 'team/:id',
605
- * component: Team,
606
- * children: [{
607
- * path: 'user/:name',
608
- * component: User
609
- * }]
610
- * }]
611
- * ```
612
- *
613
- * ### Multiple Outlets
614
- *
615
- * The following route creates sibling components with multiple outlets.
616
- * When navigating to `/team/11(aux:chat/jim)`, the router creates the 'Team' component next to
617
- * the 'Chat' component. The 'Chat' component is placed into the 'aux' outlet.
618
- *
619
- * ```ts
620
- * [{
621
- * path: 'team/:id',
622
- * component: Team
623
- * }, {
624
- * path: 'chat/:user',
625
- * component: Chat
626
- * outlet: 'aux'
627
- * }]
628
- * ```
629
- *
630
- * ### Wild Cards
631
- *
632
- * The following route uses wild-card notation to specify a component
633
- * that is always instantiated regardless of where you navigate to.
634
- *
635
- * ```ts
636
- * [{
637
- * path: '**',
638
- * component: WildcardComponent
639
- * }]
640
- * ```
641
- *
642
- * ### Redirects
643
- *
644
- * The following route uses the `redirectTo` property to ignore a segment of
645
- * a given URL when looking for a child path.
646
- *
647
- * When navigating to '/team/11/legacy/user/jim', the router changes the URL segment
648
- * '/team/11/legacy/user/jim' to '/team/11/user/jim', and then instantiates
649
- * the Team component with the User child component in it.
650
- *
651
- * ```ts
652
- * [{
653
- * path: 'team/:id',
654
- * component: Team,
655
- * children: [{
656
- * path: 'legacy/user/:name',
657
- * redirectTo: 'user/:name'
658
- * }, {
659
- * path: 'user/:name',
660
- * component: User
661
- * }]
662
- * }]
663
- * ```
664
- *
665
- * The redirect path can be relative, as shown in this example, or absolute.
666
- * If we change the `redirectTo` value in the example to the absolute URL segment '/user/:name',
667
- * the result URL is also absolute, '/user/jim'.
668
-
669
- * ### Empty Path
670
- *
671
- * Empty-path route configurations can be used to instantiate components that do not 'consume'
672
- * any URL segments.
673
- *
674
- * In the following configuration, when navigating to
675
- * `/team/11`, the router instantiates the 'AllUsers' component.
676
- *
677
- * ```ts
678
- * [{
679
- * path: 'team/:id',
680
- * component: Team,
681
- * children: [{
682
- * path: '',
683
- * component: AllUsers
684
- * }, {
685
- * path: 'user/:name',
686
- * component: User
687
- * }]
688
- * }]
689
- * ```
690
- *
691
- * Empty-path routes can have children. In the following example, when navigating
692
- * to `/team/11/user/jim`, the router instantiates the wrapper component with
693
- * the user component in it.
694
- *
695
- * Note that an empty path route inherits its parent's parameters and data.
696
- *
697
- * ```ts
698
- * [{
699
- * path: 'team/:id',
700
- * component: Team,
701
- * children: [{
702
- * path: '',
703
- * component: WrapperCmp,
704
- * children: [{
705
- * path: 'user/:name',
706
- * component: User
707
- * }]
708
- * }]
709
- * }]
710
- * ```
711
- *
712
- * ### Matching Strategy
713
- *
714
- * The default path-match strategy is 'prefix', which means that the router
715
- * checks URL elements from the left to see if the URL matches a specified path.
716
- * For example, '/team/11/user' matches 'team/:id'.
717
- *
718
- * ```ts
719
- * [{
720
- * path: '',
721
- * pathMatch: 'prefix', //default
722
- * redirectTo: 'main'
723
- * }, {
724
- * path: 'main',
725
- * component: Main
726
- * }]
727
- * ```
728
- *
729
- * You can specify the path-match strategy 'full' to make sure that the path
730
- * covers the whole unconsumed URL. It is important to do this when redirecting
731
- * empty-path routes. Otherwise, because an empty path is a prefix of any URL,
732
- * the router would apply the redirect even when navigating to the redirect destination,
733
- * creating an endless loop.
734
- *
735
- * In the following example, supplying the 'full' `pathMatch` strategy ensures
736
- * that the router applies the redirect if and only if navigating to '/'.
737
- *
738
- * ```ts
739
- * [{
740
- * path: '',
741
- * pathMatch: 'full',
742
- * redirectTo: 'main'
743
- * }, {
744
- * path: 'main',
745
- * component: Main
746
- * }]
747
- * ```
748
- *
749
- * ### Componentless Routes
750
- *
751
- * You can share parameters between sibling components.
752
- * For example, suppose that two sibling components should go next to each other,
753
- * and both of them require an ID parameter. You can accomplish this using a route
754
- * that does not specify a component at the top level.
755
- *
756
- * In the following example, 'MainChild' and 'AuxChild' are siblings.
757
- * When navigating to 'parent/10/(a//aux:b)', the route instantiates
758
- * the main child and aux child components next to each other.
759
- * For this to work, the application component must have the primary and aux outlets defined.
760
- *
761
- * ```ts
762
- * [{
763
- * path: 'parent/:id',
764
- * children: [
765
- * { path: 'a', component: MainChild },
766
- * { path: 'b', component: AuxChild, outlet: 'aux' }
767
- * ]
768
- * }]
769
- * ```
770
- *
771
- * The router merges the parameters, data, and resolve of the componentless
772
- * parent into the parameters, data, and resolve of the children.
773
- *
774
- * This is especially useful when child components are defined
775
- * with an empty path string, as in the following example.
776
- * With this configuration, navigating to '/parent/10' creates
777
- * the main child and aux components.
778
- *
779
- * ```ts
780
- * [{
781
- * path: 'parent/:id',
782
- * children: [
783
- * { path: '', component: MainChild },
784
- * { path: '', component: AuxChild, outlet: 'aux' }
785
- * ]
786
- * }]
787
- * ```
788
- *
789
- * ### Lazy Loading
790
- *
791
- * Lazy loading speeds up application load time by splitting the application
792
- * into multiple bundles and loading them on demand.
793
- * To use lazy loading, provide the `loadChildren` property in the `Route` object,
794
- * instead of the `children` property.
795
- *
796
- * Given the following example route, the router will lazy load
797
- * the associated module on demand using the browser native import system.
798
- *
799
- * ```ts
800
- * [{
801
- * path: 'lazy',
802
- * loadChildren: () => import('./lazy-route/lazy.module').then(mod => mod.LazyModule),
803
- * }];
804
- * ```
805
- *
806
- * @publicApi
807
- */
808
- interface Route {
809
- /**
810
- * Used to define a page title for the route. This can be a static string or an `Injectable` that
811
- * implements `Resolve`.
812
- *
813
- * @see {@link TitleStrategy}
814
- */
815
- title?: string | Type<Resolve<string>> | ResolveFn<string>;
816
- /**
817
- * The path to match against. Cannot be used together with a custom `matcher` function.
818
- * A URL string that uses router matching notation.
819
- * Can be a wild card (`**`) that matches any URL (see Usage Notes below).
820
- * Default is "/" (the root path).
821
- *
822
- */
823
- path?: string;
824
- /**
825
- * The path-matching strategy, one of 'prefix' or 'full'.
826
- * Default is 'prefix'.
827
- *
828
- * By default, the router checks URL elements from the left to see if the URL
829
- * matches a given path and stops when there is a config match. Importantly there must still be a
830
- * config match for each segment of the URL. For example, '/team/11/user' matches the prefix
831
- * 'team/:id' if one of the route's children matches the segment 'user'. That is, the URL
832
- * '/team/11/user' matches the config
833
- * `{path: 'team/:id', children: [{path: ':user', component: User}]}`
834
- * but does not match when there are no children as in `{path: 'team/:id', component: Team}`.
835
- *
836
- * The path-match strategy 'full' matches against the entire URL.
837
- * It is important to do this when redirecting empty-path routes.
838
- * Otherwise, because an empty path is a prefix of any URL,
839
- * the router would apply the redirect even when navigating
840
- * to the redirect destination, creating an endless loop.
841
- *
842
- */
843
- pathMatch?: 'prefix' | 'full';
844
- /**
845
- * A custom URL-matching function. Cannot be used together with `path`.
846
- */
847
- matcher?: UrlMatcher;
848
- /**
849
- * The component to instantiate when the path matches.
850
- * Can be empty if child routes specify components.
851
- */
852
- component?: Type<any>;
853
- /**
854
- * An object specifying a lazy-loaded component.
855
- */
856
- loadComponent?: () => Type<unknown> | Observable<Type<unknown> | DefaultExport<Type<unknown>>> | Promise<Type<unknown> | DefaultExport<Type<unknown>>>;
857
- /**
858
- * A URL or function that returns a URL to redirect to when the path matches.
859
- *
860
- * Absolute if the URL begins with a slash (/) or the function returns a `UrlTree`, otherwise
861
- * relative to the path URL.
862
- *
863
- * The `RedirectFunction` is run in an injection context so it can call `inject` to get any
864
- * required dependencies.
865
- *
866
- * When not present, router does not redirect.
867
- */
868
- redirectTo?: string | RedirectFunction;
869
- /**
870
- * Name of a `RouterOutlet` object where the component can be placed
871
- * when the path matches.
872
- */
873
- outlet?: string;
874
- /**
875
- * An array of `CanActivateFn` or DI tokens used to look up `CanActivate()`
876
- * handlers, in order to determine if the current user is allowed to
877
- * activate the component. By default, any user can activate.
878
- *
879
- * When using a function rather than DI tokens, the function can call `inject` to get any required
880
- * dependencies. This `inject` call must be done in a synchronous context.
881
- */
882
- canActivate?: Array<CanActivateFn | DeprecatedGuard>;
883
- /**
884
- * An array of `CanMatchFn` or DI tokens used to look up `CanMatch()`
885
- * handlers, in order to determine if the current user is allowed to
886
- * match the `Route`. By default, any route can match.
887
- *
888
- * When using a function rather than DI tokens, the function can call `inject` to get any required
889
- * dependencies. This `inject` call must be done in a synchronous context.
890
- */
891
- canMatch?: Array<CanMatchFn | DeprecatedGuard>;
892
- /**
893
- * An array of `CanActivateChildFn` or DI tokens used to look up `CanActivateChild()` handlers,
894
- * in order to determine if the current user is allowed to activate
895
- * a child of the component. By default, any user can activate a child.
896
- *
897
- * When using a function rather than DI tokens, the function can call `inject` to get any required
898
- * dependencies. This `inject` call must be done in a synchronous context.
899
- */
900
- canActivateChild?: Array<CanActivateChildFn | DeprecatedGuard>;
901
- /**
902
- * An array of `CanDeactivateFn` or DI tokens used to look up `CanDeactivate()`
903
- * handlers, in order to determine if the current user is allowed to
904
- * deactivate the component. By default, any user can deactivate.
905
- *
906
- * When using a function rather than DI tokens, the function can call `inject` to get any required
907
- * dependencies. This `inject` call must be done in a synchronous context.
908
- */
909
- canDeactivate?: Array<CanDeactivateFn<any> | DeprecatedGuard>;
910
- /**
911
- * An array of `CanLoadFn` or DI tokens used to look up `CanLoad()`
912
- * handlers, in order to determine if the current user is allowed to
913
- * load the component. By default, any user can load.
914
- *
915
- * When using a function rather than DI tokens, the function can call `inject` to get any required
916
- * dependencies. This `inject` call must be done in a synchronous context.
917
- * @deprecated Use `canMatch` instead
918
- */
919
- canLoad?: Array<CanLoadFn | DeprecatedGuard>;
920
- /**
921
- * Additional developer-defined data provided to the component via
922
- * `ActivatedRoute`. By default, no additional data is passed.
923
- */
924
- data?: Data;
925
- /**
926
- * A map of DI tokens used to look up data resolvers. See `Resolve`.
927
- */
928
- resolve?: ResolveData;
929
- /**
930
- * An array of child `Route` objects that specifies a nested route
931
- * configuration.
932
- */
933
- children?: Routes;
934
- /**
935
- * An object specifying lazy-loaded child routes.
936
- */
937
- loadChildren?: LoadChildren;
938
- /**
939
- * A policy for when to run guards and resolvers on a route.
940
- *
941
- * Guards and/or resolvers will always run when a route is activated or deactivated. When a route
942
- * is unchanged, the default behavior is the same as `paramsChange`.
943
- *
944
- * `paramsChange` : Rerun the guards and resolvers when path or
945
- * path param changes. This does not include query parameters. This option is the default.
946
- * - `always` : Run on every execution.
947
- * - `pathParamsChange` : Rerun guards and resolvers when the path params
948
- * change. This does not compare matrix or query parameters.
949
- * - `paramsOrQueryParamsChange` : Run when path, matrix, or query parameters change.
950
- * - `pathParamsOrQueryParamsChange` : Rerun guards and resolvers when the path params
951
- * change or query params have changed. This does not include matrix parameters.
952
- *
953
- * @see {@link RunGuardsAndResolvers}
954
- */
955
- runGuardsAndResolvers?: RunGuardsAndResolvers;
956
- /**
957
- * A `Provider` array to use for this `Route` and its `children`.
958
- *
959
- * The `Router` will create a new `EnvironmentInjector` for this
960
- * `Route` and use it for this `Route` and its `children`. If this
961
- * route also has a `loadChildren` function which returns an `NgModuleRef`, this injector will be
962
- * used as the parent of the lazy loaded module.
963
- */
964
- providers?: Array<Provider | EnvironmentProviders>;
965
- }
966
- interface LoadedRouterConfig {
967
- routes: Route[];
968
- injector: EnvironmentInjector | undefined;
969
- }
970
- /**
971
- * @description
972
- *
973
- * Interface that a class can implement to be a guard deciding if a route can be activated.
974
- * If all guards return `true`, navigation continues. If any guard returns `false`,
975
- * navigation is cancelled. If any guard returns a `UrlTree`, the current navigation
976
- * is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
977
- *
978
- * The following example implements a `CanActivate` function that checks whether the
979
- * current user has permission to activate the requested route.
980
- *
981
- * ```ts
982
- * class UserToken {}
983
- * class Permissions {
984
- * canActivate(): boolean {
985
- * return true;
986
- * }
987
- * }
988
- *
989
- * @Injectable()
990
- * class CanActivateTeam implements CanActivate {
991
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
992
- *
993
- * canActivate(
994
- * route: ActivatedRouteSnapshot,
995
- * state: RouterStateSnapshot
996
- * ): MaybeAsync<GuardResult> {
997
- * return this.permissions.canActivate(this.currentUser, route.params.id);
998
- * }
999
- * }
1000
- * ```
1001
- *
1002
- * Here, the defined guard function is provided as part of the `Route` object
1003
- * in the router configuration:
1004
- *
1005
- * ```ts
1006
- * @NgModule({
1007
- * imports: [
1008
- * RouterModule.forRoot([
1009
- * {
1010
- * path: 'team/:id',
1011
- * component: TeamComponent,
1012
- * canActivate: [CanActivateTeam]
1013
- * }
1014
- * ])
1015
- * ],
1016
- * providers: [CanActivateTeam, UserToken, Permissions]
1017
- * })
1018
- * class AppModule {}
1019
- * ```
1020
- *
1021
- * @publicApi
1022
- */
1023
- interface CanActivate {
1024
- canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>;
1025
- }
1026
- /**
1027
- * The signature of a function used as a `canActivate` guard on a `Route`.
1028
- *
1029
- * If all guards return `true`, navigation continues. If any guard returns `false`,
1030
- * navigation is cancelled. If any guard returns a `UrlTree`, the current navigation
1031
- * is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
1032
- *
1033
- * The following example implements and uses a `CanActivateFn` that checks whether the
1034
- * current user has permission to activate the requested route.
1035
- *
1036
- * ```ts
1037
- * @Injectable()
1038
- * class UserToken {}
1039
- *
1040
- * @Injectable()
1041
- * class PermissionsService {
1042
- * canActivate(currentUser: UserToken, userId: string): boolean {
1043
- * return true;
1044
- * }
1045
- * canMatch(currentUser: UserToken): boolean {
1046
- * return true;
1047
- * }
1048
- * }
1049
- *
1050
- * const canActivateTeam: CanActivateFn = (
1051
- * route: ActivatedRouteSnapshot,
1052
- * state: RouterStateSnapshot,
1053
- * ) => {
1054
- * return inject(PermissionsService).canActivate(inject(UserToken), route.params['id']);
1055
- * };
1056
- * ```
1057
- *
1058
- * Here, the defined guard function is provided as part of the `Route` object
1059
- * in the router configuration:
1060
- *
1061
- * ```ts
1062
- * bootstrapApplication(App, {
1063
- * providers: [
1064
- * provideRouter([
1065
- * {
1066
- * path: 'team/:id',
1067
- * component: TeamComponent,
1068
- * canActivate: [canActivateTeam],
1069
- * },
1070
- * ]),
1071
- * ],
1072
- * });
1073
- * ```
1074
- *
1075
- * @publicApi
1076
- * @see {@link Route}
1077
- */
1078
- type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<GuardResult>;
1079
- /**
1080
- * @description
1081
- *
1082
- * Interface that a class can implement to be a guard deciding if a child route can be activated.
1083
- * If all guards return `true`, navigation continues. If any guard returns `false`,
1084
- * navigation is cancelled. If any guard returns a `UrlTree`, current navigation
1085
- * is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
1086
- *
1087
- * The following example implements a `CanActivateChild` function that checks whether the
1088
- * current user has permission to activate the requested child route.
1089
- *
1090
- * ```ts
1091
- * class UserToken {}
1092
- * class Permissions {
1093
- * canActivate(user: UserToken, id: string): boolean {
1094
- * return true;
1095
- * }
1096
- * }
1097
- *
1098
- * @Injectable()
1099
- * class CanActivateTeam implements CanActivateChild {
1100
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
1101
- *
1102
- * canActivateChild(
1103
- * route: ActivatedRouteSnapshot,
1104
- * state: RouterStateSnapshot
1105
- * ): MaybeAsync<GuardResult> {
1106
- * return this.permissions.canActivate(this.currentUser, route.params.id);
1107
- * }
1108
- * }
1109
- * ```
1110
- *
1111
- * Here, the defined guard function is provided as part of the `Route` object
1112
- * in the router configuration:
1113
- *
1114
- * ```ts
1115
- * @NgModule({
1116
- * imports: [
1117
- * RouterModule.forRoot([
1118
- * {
1119
- * path: 'root',
1120
- * canActivateChild: [CanActivateTeam],
1121
- * children: [
1122
- * {
1123
- * path: 'team/:id',
1124
- * component: TeamComponent
1125
- * }
1126
- * ]
1127
- * }
1128
- * ])
1129
- * ],
1130
- * providers: [CanActivateTeam, UserToken, Permissions]
1131
- * })
1132
- * class AppModule {}
1133
- * ```
1134
- *
1135
- * @publicApi
1136
- */
1137
- interface CanActivateChild {
1138
- canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>;
1139
- }
1140
- /**
1141
- * The signature of a function used as a `canActivateChild` guard on a `Route`.
1142
- *
1143
- * If all guards return `true`, navigation continues. If any guard returns `false`,
1144
- * navigation is cancelled. If any guard returns a `UrlTree`, the current navigation
1145
- * is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
1146
- *
1147
- * The following example implements a `canActivate` function that checks whether the
1148
- * current user has permission to activate the requested route.
1149
- *
1150
- * {@example router/route_functional_guards.ts region="CanActivateChildFn"}
1151
- *
1152
- * @publicApi
1153
- * @see {@link Route}
1154
- */
1155
- type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<GuardResult>;
1156
- /**
1157
- * @description
1158
- *
1159
- * Interface that a class can implement to be a guard deciding if a route can be deactivated.
1160
- * If all guards return `true`, navigation continues. If any guard returns `false`,
1161
- * navigation is cancelled. If any guard returns a `UrlTree`, current navigation
1162
- * is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
1163
- *
1164
- * The following example implements a `CanDeactivate` function that checks whether the
1165
- * current user has permission to deactivate the requested route.
1166
- *
1167
- * ```ts
1168
- * class UserToken {}
1169
- * class Permissions {
1170
- * canDeactivate(user: UserToken, id: string): boolean {
1171
- * return true;
1172
- * }
1173
- * }
1174
- * ```
1175
- *
1176
- * Here, the defined guard function is provided as part of the `Route` object
1177
- * in the router configuration:
1178
- *
1179
- * ```ts
1180
- * @Injectable()
1181
- * class CanDeactivateTeam implements CanDeactivate<TeamComponent> {
1182
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
1183
- *
1184
- * canDeactivate(
1185
- * component: TeamComponent,
1186
- * currentRoute: ActivatedRouteSnapshot,
1187
- * currentState: RouterStateSnapshot,
1188
- * nextState: RouterStateSnapshot
1189
- * ): MaybeAsync<GuardResult> {
1190
- * return this.permissions.canDeactivate(this.currentUser, route.params.id);
1191
- * }
1192
- * }
1193
- *
1194
- * @NgModule({
1195
- * imports: [
1196
- * RouterModule.forRoot([
1197
- * {
1198
- * path: 'team/:id',
1199
- * component: TeamComponent,
1200
- * canDeactivate: [CanDeactivateTeam]
1201
- * }
1202
- * ])
1203
- * ],
1204
- * providers: [CanDeactivateTeam, UserToken, Permissions]
1205
- * })
1206
- * class AppModule {}
1207
- * ```
1208
- *
1209
- * @publicApi
1210
- */
1211
- interface CanDeactivate<T> {
1212
- canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot): MaybeAsync<GuardResult>;
1213
- }
1214
- /**
1215
- * The signature of a function used as a `canDeactivate` guard on a `Route`.
1216
- *
1217
- * If all guards return `true`, navigation continues. If any guard returns `false`,
1218
- * navigation is cancelled. If any guard returns a `UrlTree`, the current navigation
1219
- * is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
1220
- *
1221
- * The following example implements and uses a `CanDeactivateFn` that checks whether the
1222
- * user component has unsaved changes before navigating away from the route.
1223
- *
1224
- * {@example router/route_functional_guards.ts region="CanDeactivateFn"}
1225
- *
1226
- * @publicApi
1227
- * @see {@link Route}
1228
- */
1229
- type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => MaybeAsync<GuardResult>;
1230
- /**
1231
- * @description
1232
- *
1233
- * Interface that a class can implement to be a guard deciding if a `Route` can be matched.
1234
- * If all guards return `true`, navigation continues and the `Router` will use the `Route` during
1235
- * activation. If any guard returns `false`, the `Route` is skipped for matching and other `Route`
1236
- * configurations are processed instead.
1237
- *
1238
- * The following example implements a `CanMatch` function that decides whether the
1239
- * current user has permission to access the users page.
1240
- *
1241
- *
1242
- * ```ts
1243
- * class UserToken {}
1244
- * class Permissions {
1245
- * canAccess(user: UserToken, route: Route, segments: UrlSegment[]): boolean {
1246
- * return true;
1247
- * }
1248
- * }
1249
- *
1250
- * @Injectable()
1251
- * class CanMatchTeamSection implements CanMatch {
1252
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
1253
- *
1254
- * canMatch(route: Route, segments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean {
1255
- * return this.permissions.canAccess(this.currentUser, route, segments);
1256
- * }
1257
- * }
1258
- * ```
1259
- *
1260
- * Here, the defined guard function is provided as part of the `Route` object
1261
- * in the router configuration:
1262
- *
1263
- * ```ts
1264
- * @NgModule({
1265
- * imports: [
1266
- * RouterModule.forRoot([
1267
- * {
1268
- * path: 'team/:id',
1269
- * component: TeamComponent,
1270
- * loadChildren: () => import('./team').then(mod => mod.TeamModule),
1271
- * canMatch: [CanMatchTeamSection]
1272
- * },
1273
- * {
1274
- * path: '**',
1275
- * component: NotFoundComponent
1276
- * }
1277
- * ])
1278
- * ],
1279
- * providers: [CanMatchTeamSection, UserToken, Permissions]
1280
- * })
1281
- * class AppModule {}
1282
- * ```
1283
- *
1284
- * If the `CanMatchTeamSection` were to return `false`, the router would continue navigating to the
1285
- * `team/:id` URL, but would load the `NotFoundComponent` because the `Route` for `'team/:id'`
1286
- * could not be used for a URL match but the catch-all `**` `Route` did instead.
1287
- *
1288
- * @publicApi
1289
- */
1290
- interface CanMatch {
1291
- canMatch(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>;
1292
- }
1293
- /**
1294
- * The signature of a function used as a `canMatch` guard on a `Route`.
1295
- *
1296
- * If all guards return `true`, navigation continues and the `Router` will use the `Route` during
1297
- * activation. If any guard returns `false`, the `Route` is skipped for matching and other `Route`
1298
- * configurations are processed instead.
1299
- *
1300
- * The following example implements and uses a `CanMatchFn` that checks whether the
1301
- * current user has permission to access the team page.
1302
- *
1303
- * {@example router/route_functional_guards.ts region="CanMatchFn"}
1304
- *
1305
- * @param route The route configuration.
1306
- * @param segments The URL segments that have not been consumed by previous parent route evaluations.
1307
- *
1308
- * @publicApi
1309
- * @see {@link Route}
1310
- */
1311
- type CanMatchFn = (route: Route, segments: UrlSegment[]) => MaybeAsync<GuardResult>;
1312
- /**
1313
- * @description
1314
- *
1315
- * Interface that classes can implement to be a data provider.
1316
- * A data provider class can be used with the router to resolve data during navigation.
1317
- * The interface defines a `resolve()` method that is invoked right after the `ResolveStart`
1318
- * router event. The router waits for the data to be resolved before the route is finally activated.
1319
- *
1320
- * The following example implements a `resolve()` method that retrieves the data
1321
- * needed to activate the requested route.
1322
- *
1323
- * ```ts
1324
- * @Injectable({ providedIn: 'root' })
1325
- * export class HeroResolver implements Resolve<Hero> {
1326
- * constructor(private service: HeroService) {}
1327
- *
1328
- * resolve(
1329
- * route: ActivatedRouteSnapshot,
1330
- * state: RouterStateSnapshot
1331
- * ): Observable<Hero>|Promise<Hero>|Hero {
1332
- * return this.service.getHero(route.paramMap.get('id'));
1333
- * }
1334
- * }
1335
- * ```
1336
- *
1337
- * Here, the defined `resolve()` function is provided as part of the `Route` object
1338
- * in the router configuration:
1339
- *
1340
- * ```ts
1341
- * @NgModule({
1342
- * imports: [
1343
- * RouterModule.forRoot([
1344
- * {
1345
- * path: 'detail/:id',
1346
- * component: HeroDetailComponent,
1347
- * resolve: {
1348
- * hero: HeroResolver
1349
- * }
1350
- * }
1351
- * ])
1352
- * ],
1353
- * exports: [RouterModule]
1354
- * })
1355
- * export class AppRoutingModule {}
1356
- * ```
1357
- *
1358
- * And you can access to your resolved data from `HeroComponent`:
1359
- *
1360
- * ```ts
1361
- * @Component({
1362
- * selector: "app-hero",
1363
- * templateUrl: "hero.component.html",
1364
- * })
1365
- * export class HeroComponent {
1366
- *
1367
- * constructor(private activatedRoute: ActivatedRoute) {}
1368
- *
1369
- * ngOnInit() {
1370
- * this.activatedRoute.data.subscribe(({ hero }) => {
1371
- * // do something with your resolved data ...
1372
- * })
1373
- * }
1374
- *
1375
- * }
1376
- * ```
1377
- *
1378
- * @usageNotes
1379
- *
1380
- * When both guard and resolvers are specified, the resolvers are not executed until
1381
- * all guards have run and succeeded.
1382
- * For example, consider the following route configuration:
1383
- *
1384
- * ```ts
1385
- * {
1386
- * path: 'base'
1387
- * canActivate: [BaseGuard],
1388
- * resolve: {data: BaseDataResolver}
1389
- * children: [
1390
- * {
1391
- * path: 'child',
1392
- * guards: [ChildGuard],
1393
- * component: ChildComponent,
1394
- * resolve: {childData: ChildDataResolver}
1395
- * }
1396
- * ]
1397
- * }
1398
- * ```
1399
- * The order of execution is: BaseGuard, ChildGuard, BaseDataResolver, ChildDataResolver.
1400
- *
1401
- * @publicApi
1402
- * @see {@link ResolveFn}
1403
- */
1404
- interface Resolve<T> {
1405
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<T | RedirectCommand>;
1406
- }
1407
- /**
1408
- * Function type definition for a data provider.
1409
- *
1410
- * A data provider can be used with the router to resolve data during navigation.
1411
- * The router waits for the data to be resolved before the route is finally activated.
1412
- *
1413
- * A resolver can also redirect a `RedirectCommand` and the Angular router will use
1414
- * it to redirect the current navigation to the new destination.
1415
- *
1416
- * @usageNotes
1417
- *
1418
- * The following example implements a function that retrieves the data
1419
- * needed to activate the requested route.
1420
- *
1421
- * ```ts
1422
- * interface Hero {
1423
- * name: string;
1424
- * }
1425
- * @Injectable()
1426
- * export class HeroService {
1427
- * getHero(id: string) {
1428
- * return {name: `Superman-${id}`};
1429
- * }
1430
- * }
1431
- *
1432
- * export const heroResolver: ResolveFn<Hero> = (
1433
- * route: ActivatedRouteSnapshot,
1434
- * state: RouterStateSnapshot,
1435
- * ) => {
1436
- * return inject(HeroService).getHero(route.paramMap.get('id')!);
1437
- * };
1438
- *
1439
- * bootstrapApplication(App, {
1440
- * providers: [
1441
- * provideRouter([
1442
- * {
1443
- * path: 'detail/:id',
1444
- * component: HeroDetailComponent,
1445
- * resolve: {hero: heroResolver},
1446
- * },
1447
- * ]),
1448
- * ],
1449
- * });
1450
- * ```
1451
- *
1452
- * And you can access to your resolved data from `HeroComponent`:
1453
- *
1454
- * ```ts
1455
- * @Component({template: ''})
1456
- * export class HeroDetailComponent {
1457
- * private activatedRoute = inject(ActivatedRoute);
1458
- *
1459
- * ngOnInit() {
1460
- * this.activatedRoute.data.subscribe(({hero}) => {
1461
- * // do something with your resolved data ...
1462
- * });
1463
- * }
1464
- * }
1465
- * ```
1466
- *
1467
- * If resolved data cannot be retrieved, you may want to redirect the user
1468
- * to a new page instead:
1469
- *
1470
- * ```ts
1471
- * export const heroResolver: ResolveFn<Hero> = async (
1472
- * route: ActivatedRouteSnapshot,
1473
- * state: RouterStateSnapshot,
1474
- * ) => {
1475
- * const router = inject(Router);
1476
- * const heroService = inject(HeroService);
1477
- * try {
1478
- * return await heroService.getHero(route.paramMap.get('id')!);
1479
- * } catch {
1480
- * return new RedirectCommand(router.parseUrl('/404'));
1481
- * }
1482
- * };
1483
- * ```
1484
- *
1485
- * When both guard and resolvers are specified, the resolvers are not executed until
1486
- * all guards have run and succeeded.
1487
- * For example, consider the following route configuration:
1488
- *
1489
- * ```ts
1490
- * {
1491
- * path: 'base'
1492
- * canActivate: [baseGuard],
1493
- * resolve: {data: baseDataResolver}
1494
- * children: [
1495
- * {
1496
- * path: 'child',
1497
- * canActivate: [childGuard],
1498
- * component: ChildComponent,
1499
- * resolve: {childData: childDataResolver}
1500
- * }
1501
- * ]
1502
- * }
1503
- * ```
1504
- * The order of execution is: baseGuard, childGuard, baseDataResolver, childDataResolver.
1505
- *
1506
- * @publicApi
1507
- * @see {@link Route}
1508
- */
1509
- type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<T | RedirectCommand>;
1510
- /**
1511
- * @description
1512
- *
1513
- * Interface that a class can implement to be a guard deciding if children can be loaded.
1514
- * If all guards return `true`, navigation continues. If any guard returns `false`,
1515
- * navigation is cancelled. If any guard returns a `UrlTree`, current navigation
1516
- * is cancelled and a new navigation starts to the `UrlTree` returned from the guard.
1517
- *
1518
- * The following example implements a `CanLoad` function that decides whether the
1519
- * current user has permission to load requested child routes.
1520
- *
1521
- *
1522
- * ```ts
1523
- * class UserToken {}
1524
- * class Permissions {
1525
- * canLoadChildren(user: UserToken, id: string, segments: UrlSegment[]): boolean {
1526
- * return true;
1527
- * }
1528
- * }
1529
- *
1530
- * @Injectable()
1531
- * class CanLoadTeamSection implements CanLoad {
1532
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
1533
- *
1534
- * canLoad(route: Route, segments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean {
1535
- * return this.permissions.canLoadChildren(this.currentUser, route, segments);
1536
- * }
1537
- * }
1538
- * ```
1539
- *
1540
- * Here, the defined guard function is provided as part of the `Route` object
1541
- * in the router configuration:
1542
- *
1543
- * ```ts
1544
- * @NgModule({
1545
- * imports: [
1546
- * RouterModule.forRoot([
1547
- * {
1548
- * path: 'team/:id',
1549
- * component: TeamComponent,
1550
- * loadChildren: () => import('./team').then(mod => mod.TeamModule),
1551
- * canLoad: [CanLoadTeamSection]
1552
- * }
1553
- * ])
1554
- * ],
1555
- * providers: [CanLoadTeamSection, UserToken, Permissions]
1556
- * })
1557
- * class AppModule {}
1558
- * ```
1559
- *
1560
- * @publicApi
1561
- * @deprecated Use {@link CanMatch} instead
1562
- */
1563
- interface CanLoad {
1564
- canLoad(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>;
1565
- }
1566
- /**
1567
- * The signature of a function used as a `canLoad` guard on a `Route`.
1568
- *
1569
- * @publicApi
1570
- * @see {@link CanLoad}
1571
- * @see {@link Route}
1572
- * @see {@link CanMatch}
1573
- * @deprecated Use `Route.canMatch` and `CanMatchFn` instead
1574
- */
1575
- type CanLoadFn = (route: Route, segments: UrlSegment[]) => MaybeAsync<GuardResult>;
1576
- /**
1577
- * @description
1578
- *
1579
- * Options that modify the `Router` navigation strategy.
1580
- * Supply an object containing any of these properties to a `Router` navigation function to
1581
- * control how the navigation should be handled.
1582
- *
1583
- * @see {@link Router#navigate}
1584
- * @see {@link Router#navigateByUrl}
1585
- * @see [Routing and Navigation guide](guide/routing/common-router-tasks)
1586
- *
1587
- * @publicApi
1588
- */
1589
- interface NavigationBehaviorOptions {
1590
- /**
1591
- * How to handle a navigation request to the current URL.
1592
- *
1593
- * This value is a subset of the options available in `OnSameUrlNavigation` and
1594
- * will take precedence over the default value set for the `Router`.
1595
- *
1596
- * @see {@link OnSameUrlNavigation}
1597
- * @see {@link RouterConfigOptions}
1598
- */
1599
- onSameUrlNavigation?: OnSameUrlNavigation;
1600
- /**
1601
- * When true, navigates without pushing a new state into history.
1602
- *
1603
- * ```
1604
- * // Navigate silently to /view
1605
- * this.router.navigate(['/view'], { skipLocationChange: true });
1606
- * ```
1607
- */
1608
- skipLocationChange?: boolean;
1609
- /**
1610
- * When true, navigates while replacing the current state in history.
1611
- *
1612
- * ```
1613
- * // Navigate to /view
1614
- * this.router.navigate(['/view'], { replaceUrl: true });
1615
- * ```
1616
- */
1617
- replaceUrl?: boolean;
1618
- /**
1619
- * Developer-defined state that can be passed to any navigation.
1620
- * Access this value through the `Navigation.extras` object
1621
- * returned from the [Router.getCurrentNavigation()
1622
- * method](api/router/Router#getcurrentnavigation) while a navigation is executing.
1623
- *
1624
- * After a navigation completes, the router writes an object containing this
1625
- * value together with a `navigationId` to `history.state`.
1626
- * The value is written when `location.go()` or `location.replaceState()`
1627
- * is called before activating this route.
1628
- *
1629
- * Note that `history.state` does not pass an object equality test because
1630
- * the router adds the `navigationId` on each navigation.
1631
- *
1632
- */
1633
- state?: {
1634
- [k: string]: any;
1635
- };
1636
- /**
1637
- * Use this to convey transient information about this particular navigation, such as how it
1638
- * happened. In this way, it's different from the persisted value `state` that will be set to
1639
- * `history.state`. This object is assigned directly to the Router's current `Navigation`
1640
- * (it is not copied or cloned), so it should be mutated with caution.
1641
- *
1642
- * One example of how this might be used is to trigger different single-page navigation animations
1643
- * depending on how a certain route was reached. For example, consider a photo gallery app, where
1644
- * you can reach the same photo URL and state via various routes:
1645
- *
1646
- * - Clicking on it in a gallery view
1647
- * - Clicking
1648
- * - "next" or "previous" when viewing another photo in the album
1649
- * - Etc.
1650
- *
1651
- * Each of these wants a different animation at navigate time. This information doesn't make sense
1652
- * to store in the persistent URL or history entry state, but it's still important to communicate
1653
- * from the rest of the application, into the router.
1654
- *
1655
- * This information could be used in coordination with the View Transitions feature and the
1656
- * `onViewTransitionCreated` callback. The information might be used in the callback to set
1657
- * classes on the document in order to control the transition animations and remove the classes
1658
- * when the transition has finished animating.
1659
- */
1660
- readonly info?: unknown;
1661
- /**
1662
- * When set, the Router will update the browser's address bar to match the given `UrlTree` instead
1663
- * of the one used for route matching.
1664
- *
1665
- *
1666
- * @usageNotes
1667
- *
1668
- * This feature is useful for redirects, such as redirecting to an error page, without changing
1669
- * the value that will be displayed in the browser's address bar.
1670
- *
1671
- * ```ts
1672
- * const canActivate: CanActivateFn = (route: ActivatedRouteSnapshot) => {
1673
- * const userService = inject(UserService);
1674
- * const router = inject(Router);
1675
- * if (!userService.isLoggedIn()) {
1676
- * const targetOfCurrentNavigation = router.getCurrentNavigation()?.finalUrl;
1677
- * const redirect = router.parseUrl('/404');
1678
- * return new RedirectCommand(redirect, {browserUrl: targetOfCurrentNavigation});
1679
- * }
1680
- * return true;
1681
- * };
1682
- * ```
1683
- *
1684
- * This value is used directly, without considering any `UrlHandingStrategy`. In this way,
1685
- * `browserUrl` can also be used to use a different value for the browser URL than what would have
1686
- * been produced by from the navigation due to `UrlHandlingStrategy.merge`.
1687
- *
1688
- * This value only affects the path presented in the browser's address bar. It does not apply to
1689
- * the internal `Router` state. Information such as `params` and `data` will match the internal
1690
- * state used to match routes which will be different from the browser URL when using this feature
1691
- * The same is true when using other APIs that cause the browser URL the differ from the Router
1692
- * state, such as `skipLocationChange`.
1693
- */
1694
- readonly browserUrl?: UrlTree | string;
1695
- }
1696
-
1697
- declare class Tree<T> {
1698
- constructor(root: TreeNode<T>);
1699
- get root(): T;
1700
- }
1701
- declare class TreeNode<T> {
1702
- value: T;
1703
- children: TreeNode<T>[];
1704
- constructor(value: T, children: TreeNode<T>[]);
1705
- toString(): string;
1706
- }
1707
-
1708
- /**
1709
- * Represents the state of the router as a tree of activated routes.
1710
- *
1711
- * @usageNotes
1712
- *
1713
- * Every node in the route tree is an `ActivatedRoute` instance
1714
- * that knows about the "consumed" URL segments, the extracted parameters,
1715
- * and the resolved data.
1716
- * Use the `ActivatedRoute` properties to traverse the tree from any node.
1717
- *
1718
- * The following fragment shows how a component gets the root node
1719
- * of the current state to establish its own route tree:
1720
- *
1721
- * ```ts
1722
- * @Component({templateUrl:'template.html'})
1723
- * class MyComponent {
1724
- * constructor(router: Router) {
1725
- * const state: RouterState = router.routerState;
1726
- * const root: ActivatedRoute = state.root;
1727
- * const child = root.firstChild;
1728
- * const id: Observable<string> = child.params.map(p => p.id);
1729
- * //...
1730
- * }
1731
- * }
1732
- * ```
1733
- *
1734
- * @see {@link ActivatedRoute}
1735
- * @see [Getting route information](guide/routing/common-router-tasks#getting-route-information)
1736
- *
1737
- * @publicApi
1738
- */
1739
- declare class RouterState extends Tree<ActivatedRoute> {
1740
- /** The current snapshot of the router state */
1741
- snapshot: RouterStateSnapshot;
1742
- toString(): string;
1743
- }
1744
- /**
1745
- * Provides access to information about a route associated with a component
1746
- * that is loaded in an outlet.
1747
- * Use to traverse the `RouterState` tree and extract information from nodes.
1748
- *
1749
- * The following example shows how to construct a component using information from a
1750
- * currently activated route.
1751
- *
1752
- * Note: the observables in this class only emit when the current and previous values differ based
1753
- * on shallow equality. For example, changing deeply nested properties in resolved `data` will not
1754
- * cause the `ActivatedRoute.data` `Observable` to emit a new value.
1755
- *
1756
- * {@example router/activated-route/module.ts region="activated-route"
1757
- * header="activated-route.component.ts"}
1758
- *
1759
- * @see [Getting route information](guide/routing/common-router-tasks#getting-route-information)
1760
- *
1761
- * @publicApi
1762
- */
1763
- declare class ActivatedRoute {
1764
- /** The outlet name of the route, a constant. */
1765
- outlet: string;
1766
- /** The component of the route, a constant. */
1767
- component: Type<any> | null;
1768
- /** The current snapshot of this route */
1769
- snapshot: ActivatedRouteSnapshot;
1770
- /** An Observable of the resolved route title */
1771
- readonly title: Observable<string | undefined>;
1772
- /** An observable of the URL segments matched by this route. */
1773
- url: Observable<UrlSegment[]>;
1774
- /** An observable of the matrix parameters scoped to this route. */
1775
- params: Observable<Params>;
1776
- /** An observable of the query parameters shared by all the routes. */
1777
- queryParams: Observable<Params>;
1778
- /** An observable of the URL fragment shared by all the routes. */
1779
- fragment: Observable<string | null>;
1780
- /** An observable of the static and resolved data of this route. */
1781
- data: Observable<Data>;
1782
- /** The configuration used to match this route. */
1783
- get routeConfig(): Route | null;
1784
- /** The root of the router state. */
1785
- get root(): ActivatedRoute;
1786
- /** The parent of this route in the router state tree. */
1787
- get parent(): ActivatedRoute | null;
1788
- /** The first child of this route in the router state tree. */
1789
- get firstChild(): ActivatedRoute | null;
1790
- /** The children of this route in the router state tree. */
1791
- get children(): ActivatedRoute[];
1792
- /** The path from the root of the router state tree to this route. */
1793
- get pathFromRoot(): ActivatedRoute[];
1794
- /**
1795
- * An Observable that contains a map of the required and optional parameters
1796
- * specific to the route.
1797
- * The map supports retrieving single and multiple values from the same parameter.
1798
- */
1799
- get paramMap(): Observable<ParamMap>;
1800
- /**
1801
- * An Observable that contains a map of the query parameters available to all routes.
1802
- * The map supports retrieving single and multiple values from the query parameter.
1803
- */
1804
- get queryParamMap(): Observable<ParamMap>;
1805
- toString(): string;
1806
- }
1807
- /**
1808
- * @description
1809
- *
1810
- * Contains the information about a route associated with a component loaded in an
1811
- * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to
1812
- * traverse the router state tree.
1813
- *
1814
- * The following example initializes a component with route information extracted
1815
- * from the snapshot of the root node at the time of creation.
1816
- *
1817
- * ```ts
1818
- * @Component({templateUrl:'./my-component.html'})
1819
- * class MyComponent {
1820
- * constructor(route: ActivatedRoute) {
1821
- * const id: string = route.snapshot.params.id;
1822
- * const url: string = route.snapshot.url.join('');
1823
- * const user = route.snapshot.data.user;
1824
- * }
1825
- * }
1826
- * ```
1827
- *
1828
- * @publicApi
1829
- */
1830
- declare class ActivatedRouteSnapshot {
1831
- /** The URL segments matched by this route */
1832
- url: UrlSegment[];
1833
- /**
1834
- * The matrix parameters scoped to this route.
1835
- *
1836
- * You can compute all params (or data) in the router state or to get params outside
1837
- * of an activated component by traversing the `RouterState` tree as in the following
1838
- * example:
1839
- * ```ts
1840
- * collectRouteParams(router: Router) {
1841
- * let params = {};
1842
- * let stack: ActivatedRouteSnapshot[] = [router.routerState.snapshot.root];
1843
- * while (stack.length > 0) {
1844
- * const route = stack.pop()!;
1845
- * params = {...params, ...route.params};
1846
- * stack.push(...route.children);
1847
- * }
1848
- * return params;
1849
- * }
1850
- * ```
1851
- */
1852
- params: Params;
1853
- /** The query parameters shared by all the routes */
1854
- queryParams: Params;
1855
- /** The URL fragment shared by all the routes */
1856
- fragment: string | null;
1857
- /** The static and resolved data of this route */
1858
- data: Data;
1859
- /** The outlet name of the route */
1860
- outlet: string;
1861
- /** The component of the route */
1862
- component: Type<any> | null;
1863
- /** The configuration used to match this route **/
1864
- readonly routeConfig: Route | null;
1865
- /** The resolved route title */
1866
- get title(): string | undefined;
1867
- /** The root of the router state */
1868
- get root(): ActivatedRouteSnapshot;
1869
- /** The parent of this route in the router state tree */
1870
- get parent(): ActivatedRouteSnapshot | null;
1871
- /** The first child of this route in the router state tree */
1872
- get firstChild(): ActivatedRouteSnapshot | null;
1873
- /** The children of this route in the router state tree */
1874
- get children(): ActivatedRouteSnapshot[];
1875
- /** The path from the root of the router state tree to this route */
1876
- get pathFromRoot(): ActivatedRouteSnapshot[];
1877
- get paramMap(): ParamMap;
1878
- get queryParamMap(): ParamMap;
1879
- toString(): string;
1880
- }
1881
- /**
1882
- * @description
1883
- *
1884
- * Represents the state of the router at a moment in time.
1885
- *
1886
- * This is a tree of activated route snapshots. Every node in this tree knows about
1887
- * the "consumed" URL segments, the extracted parameters, and the resolved data.
1888
- *
1889
- * The following example shows how a component is initialized with information
1890
- * from the snapshot of the root node's state at the time of creation.
1891
- *
1892
- * ```ts
1893
- * @Component({templateUrl:'template.html'})
1894
- * class MyComponent {
1895
- * constructor(router: Router) {
1896
- * const state: RouterState = router.routerState;
1897
- * const snapshot: RouterStateSnapshot = state.snapshot;
1898
- * const root: ActivatedRouteSnapshot = snapshot.root;
1899
- * const child = root.firstChild;
1900
- * const id: Observable<string> = child.params.map(p => p.id);
1901
- * //...
1902
- * }
1903
- * }
1904
- * ```
1905
- *
1906
- * @publicApi
1907
- */
1908
- declare class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> {
1909
- /** The url from which this snapshot was created */
1910
- url: string;
1911
- toString(): string;
1912
- }
1913
-
1914
- /**
1915
- * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
1916
- *
1917
- * @publicApi
1918
- *
1919
- *
1920
- * @param relativeTo The `ActivatedRouteSnapshot` to apply the commands to
1921
- * @param commands An array of URL fragments with which to construct the new URL tree.
1922
- * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
1923
- * segments, followed by the parameters for each segment.
1924
- * The fragments are applied to the one provided in the `relativeTo` parameter.
1925
- * @param queryParams The query parameters for the `UrlTree`. `null` if the `UrlTree` does not have
1926
- * any query parameters.
1927
- * @param fragment The fragment for the `UrlTree`. `null` if the `UrlTree` does not have a fragment.
1928
- *
1929
- * @usageNotes
1930
- *
1931
- * ```ts
1932
- * // create /team/33/user/11
1933
- * createUrlTreeFromSnapshot(snapshot, ['/team', 33, 'user', 11]);
1934
- *
1935
- * // create /team/33;expand=true/user/11
1936
- * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {expand: true}, 'user', 11]);
1937
- *
1938
- * // you can collapse static segments like this (this works only with the first passed-in value):
1939
- * createUrlTreeFromSnapshot(snapshot, ['/team/33/user', userId]);
1940
- *
1941
- * // If the first segment can contain slashes, and you do not want the router to split it,
1942
- * // you can do the following:
1943
- * createUrlTreeFromSnapshot(snapshot, [{segmentPath: '/one/two'}]);
1944
- *
1945
- * // create /team/33/(user/11//right:chat)
1946
- * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right:
1947
- * 'chat'}}], null, null);
1948
- *
1949
- * // remove the right secondary node
1950
- * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
1951
- *
1952
- * // For the examples below, assume the current URL is for the `/team/33/user/11` and the
1953
- * `ActivatedRouteSnapshot` points to `user/11`:
1954
- *
1955
- * // navigate to /team/33/user/11/details
1956
- * createUrlTreeFromSnapshot(snapshot, ['details']);
1957
- *
1958
- * // navigate to /team/33/user/22
1959
- * createUrlTreeFromSnapshot(snapshot, ['../22']);
1960
- *
1961
- * // navigate to /team/44/user/22
1962
- * createUrlTreeFromSnapshot(snapshot, ['../../team/44/user/22']);
1963
- * ```
1964
- */
1965
- declare function createUrlTreeFromSnapshot(relativeTo: ActivatedRouteSnapshot, commands: any[], queryParams?: Params | null, fragment?: string | null): UrlTree;
1966
-
1967
- /**
1968
- * Identifies the call or event that triggered a navigation.
1969
- *
1970
- * * 'imperative': Triggered by `router.navigateByUrl()` or `router.navigate()`.
1971
- * * 'popstate' : Triggered by a `popstate` event.
1972
- * * 'hashchange'-: Triggered by a `hashchange` event.
1973
- *
1974
- * @publicApi
1975
- */
1976
- type NavigationTrigger = 'imperative' | 'popstate' | 'hashchange';
1977
- /**
1978
- * Identifies the type of a router event.
1979
- *
1980
- * @publicApi
1981
- */
1982
- declare enum EventType {
1983
- NavigationStart = 0,
1984
- NavigationEnd = 1,
1985
- NavigationCancel = 2,
1986
- NavigationError = 3,
1987
- RoutesRecognized = 4,
1988
- ResolveStart = 5,
1989
- ResolveEnd = 6,
1990
- GuardsCheckStart = 7,
1991
- GuardsCheckEnd = 8,
1992
- RouteConfigLoadStart = 9,
1993
- RouteConfigLoadEnd = 10,
1994
- ChildActivationStart = 11,
1995
- ChildActivationEnd = 12,
1996
- ActivationStart = 13,
1997
- ActivationEnd = 14,
1998
- Scroll = 15,
1999
- NavigationSkipped = 16
2000
- }
2001
- /**
2002
- * Base for events the router goes through, as opposed to events tied to a specific
2003
- * route. Fired one time for any given navigation.
2004
- *
2005
- * The following code shows how a class subscribes to router events.
2006
- *
2007
- * ```ts
2008
- * import {Event, RouterEvent, Router} from '@angular/router';
2009
- *
2010
- * class MyService {
2011
- * constructor(public router: Router) {
2012
- * router.events.pipe(
2013
- * filter((e: Event | RouterEvent): e is RouterEvent => e instanceof RouterEvent)
2014
- * ).subscribe((e: RouterEvent) => {
2015
- * // Do something
2016
- * });
2017
- * }
2018
- * }
2019
- * ```
2020
- *
2021
- * @see {@link Event}
2022
- * @see [Router events summary](guide/routing/router-reference#router-events)
2023
- * @publicApi
2024
- */
2025
- declare class RouterEvent {
2026
- /** A unique ID that the router assigns to every router navigation. */
2027
- id: number;
2028
- /** The URL that is the destination for this navigation. */
2029
- url: string;
2030
- constructor(
2031
- /** A unique ID that the router assigns to every router navigation. */
2032
- id: number,
2033
- /** The URL that is the destination for this navigation. */
2034
- url: string);
2035
- }
2036
- /**
2037
- * An event triggered when a navigation starts.
2038
- *
2039
- * @publicApi
2040
- */
2041
- declare class NavigationStart extends RouterEvent {
2042
- readonly type = EventType.NavigationStart;
2043
- /**
2044
- * Identifies the call or event that triggered the navigation.
2045
- * An `imperative` trigger is a call to `router.navigateByUrl()` or `router.navigate()`.
2046
- *
2047
- * @see {@link NavigationEnd}
2048
- * @see {@link NavigationCancel}
2049
- * @see {@link NavigationError}
2050
- */
2051
- navigationTrigger?: NavigationTrigger;
2052
- /**
2053
- * The navigation state that was previously supplied to the `pushState` call,
2054
- * when the navigation is triggered by a `popstate` event. Otherwise null.
2055
- *
2056
- * The state object is defined by `NavigationExtras`, and contains any
2057
- * developer-defined state value, as well as a unique ID that
2058
- * the router assigns to every router transition/navigation.
2059
- *
2060
- * From the perspective of the router, the router never "goes back".
2061
- * When the user clicks on the back button in the browser,
2062
- * a new navigation ID is created.
2063
- *
2064
- * Use the ID in this previous-state object to differentiate between a newly created
2065
- * state and one returned to by a `popstate` event, so that you can restore some
2066
- * remembered state, such as scroll position.
2067
- *
2068
- */
2069
- restoredState?: {
2070
- [k: string]: any;
2071
- navigationId: number;
2072
- } | null;
2073
- constructor(
2074
- /** @docsNotRequired */
2075
- id: number,
2076
- /** @docsNotRequired */
2077
- url: string,
2078
- /** @docsNotRequired */
2079
- navigationTrigger?: NavigationTrigger,
2080
- /** @docsNotRequired */
2081
- restoredState?: {
2082
- [k: string]: any;
2083
- navigationId: number;
2084
- } | null);
2085
- /** @docsNotRequired */
2086
- toString(): string;
2087
- }
2088
- /**
2089
- * An event triggered when a navigation ends successfully.
2090
- *
2091
- * @see {@link NavigationStart}
2092
- * @see {@link NavigationCancel}
2093
- * @see {@link NavigationError}
2094
- *
2095
- * @publicApi
2096
- */
2097
- declare class NavigationEnd extends RouterEvent {
2098
- /** @docsNotRequired */
2099
- urlAfterRedirects: string;
2100
- readonly type = EventType.NavigationEnd;
2101
- constructor(
2102
- /** @docsNotRequired */
2103
- id: number,
2104
- /** @docsNotRequired */
2105
- url: string,
2106
- /** @docsNotRequired */
2107
- urlAfterRedirects: string);
2108
- /** @docsNotRequired */
2109
- toString(): string;
2110
- }
2111
- /**
2112
- * A code for the `NavigationCancel` event of the `Router` to indicate the
2113
- * reason a navigation failed.
2114
- *
2115
- * @publicApi
2116
- */
2117
- declare enum NavigationCancellationCode {
2118
- /**
2119
- * A navigation failed because a guard returned a `UrlTree` to redirect.
2120
- */
2121
- Redirect = 0,
2122
- /**
2123
- * A navigation failed because a more recent navigation started.
2124
- */
2125
- SupersededByNewNavigation = 1,
2126
- /**
2127
- * A navigation failed because one of the resolvers completed without emitting a value.
2128
- */
2129
- NoDataFromResolver = 2,
2130
- /**
2131
- * A navigation failed because a guard returned `false`.
2132
- */
2133
- GuardRejected = 3
2134
- }
2135
- /**
2136
- * A code for the `NavigationSkipped` event of the `Router` to indicate the
2137
- * reason a navigation was skipped.
2138
- *
2139
- * @publicApi
2140
- */
2141
- declare enum NavigationSkippedCode {
2142
- /**
2143
- * A navigation was skipped because the navigation URL was the same as the current Router URL.
2144
- */
2145
- IgnoredSameUrlNavigation = 0,
2146
- /**
2147
- * A navigation was skipped because the configured `UrlHandlingStrategy` return `false` for both
2148
- * the current Router URL and the target of the navigation.
2149
- *
2150
- * @see {@link UrlHandlingStrategy}
2151
- */
2152
- IgnoredByUrlHandlingStrategy = 1
2153
- }
2154
- /**
2155
- * An event triggered when a navigation is canceled, directly or indirectly.
2156
- * This can happen for several reasons including when a route guard
2157
- * returns `false` or initiates a redirect by returning a `UrlTree`.
2158
- *
2159
- * @see {@link NavigationStart}
2160
- * @see {@link NavigationEnd}
2161
- * @see {@link NavigationError}
2162
- *
2163
- * @publicApi
2164
- */
2165
- declare class NavigationCancel extends RouterEvent {
2166
- /**
2167
- * A description of why the navigation was cancelled. For debug purposes only. Use `code`
2168
- * instead for a stable cancellation reason that can be used in production.
2169
- */
2170
- reason: string;
2171
- /**
2172
- * A code to indicate why the navigation was canceled. This cancellation code is stable for
2173
- * the reason and can be relied on whereas the `reason` string could change and should not be
2174
- * used in production.
2175
- */
2176
- readonly code?: NavigationCancellationCode | undefined;
2177
- readonly type = EventType.NavigationCancel;
2178
- constructor(
2179
- /** @docsNotRequired */
2180
- id: number,
2181
- /** @docsNotRequired */
2182
- url: string,
2183
- /**
2184
- * A description of why the navigation was cancelled. For debug purposes only. Use `code`
2185
- * instead for a stable cancellation reason that can be used in production.
2186
- */
2187
- reason: string,
2188
- /**
2189
- * A code to indicate why the navigation was canceled. This cancellation code is stable for
2190
- * the reason and can be relied on whereas the `reason` string could change and should not be
2191
- * used in production.
2192
- */
2193
- code?: NavigationCancellationCode | undefined);
2194
- /** @docsNotRequired */
2195
- toString(): string;
2196
- }
2197
- /**
2198
- * An event triggered when a navigation is skipped.
2199
- * This can happen for a couple reasons including onSameUrlHandling
2200
- * is set to `ignore` and the navigation URL is not different than the
2201
- * current state.
2202
- *
2203
- * @publicApi
2204
- */
2205
- declare class NavigationSkipped extends RouterEvent {
2206
- /**
2207
- * A description of why the navigation was skipped. For debug purposes only. Use `code`
2208
- * instead for a stable skipped reason that can be used in production.
2209
- */
2210
- reason: string;
2211
- /**
2212
- * A code to indicate why the navigation was skipped. This code is stable for
2213
- * the reason and can be relied on whereas the `reason` string could change and should not be
2214
- * used in production.
2215
- */
2216
- readonly code?: NavigationSkippedCode | undefined;
2217
- readonly type = EventType.NavigationSkipped;
2218
- constructor(
2219
- /** @docsNotRequired */
2220
- id: number,
2221
- /** @docsNotRequired */
2222
- url: string,
2223
- /**
2224
- * A description of why the navigation was skipped. For debug purposes only. Use `code`
2225
- * instead for a stable skipped reason that can be used in production.
2226
- */
2227
- reason: string,
2228
- /**
2229
- * A code to indicate why the navigation was skipped. This code is stable for
2230
- * the reason and can be relied on whereas the `reason` string could change and should not be
2231
- * used in production.
2232
- */
2233
- code?: NavigationSkippedCode | undefined);
2234
- }
2235
- /**
2236
- * An event triggered when a navigation fails due to an unexpected error.
2237
- *
2238
- * @see {@link NavigationStart}
2239
- * @see {@link NavigationEnd}
2240
- * @see {@link NavigationCancel}
2241
- *
2242
- * @publicApi
2243
- */
2244
- declare class NavigationError extends RouterEvent {
2245
- /** @docsNotRequired */
2246
- error: any;
2247
- /**
2248
- * The target of the navigation when the error occurred.
2249
- *
2250
- * Note that this can be `undefined` because an error could have occurred before the
2251
- * `RouterStateSnapshot` was created for the navigation.
2252
- */
2253
- readonly target?: RouterStateSnapshot | undefined;
2254
- readonly type = EventType.NavigationError;
2255
- constructor(
2256
- /** @docsNotRequired */
2257
- id: number,
2258
- /** @docsNotRequired */
2259
- url: string,
2260
- /** @docsNotRequired */
2261
- error: any,
2262
- /**
2263
- * The target of the navigation when the error occurred.
2264
- *
2265
- * Note that this can be `undefined` because an error could have occurred before the
2266
- * `RouterStateSnapshot` was created for the navigation.
2267
- */
2268
- target?: RouterStateSnapshot | undefined);
2269
- /** @docsNotRequired */
2270
- toString(): string;
2271
- }
2272
- /**
2273
- * An event triggered when routes are recognized.
2274
- *
2275
- * @publicApi
2276
- */
2277
- declare class RoutesRecognized extends RouterEvent {
2278
- /** @docsNotRequired */
2279
- urlAfterRedirects: string;
2280
- /** @docsNotRequired */
2281
- state: RouterStateSnapshot;
2282
- readonly type = EventType.RoutesRecognized;
2283
- constructor(
2284
- /** @docsNotRequired */
2285
- id: number,
2286
- /** @docsNotRequired */
2287
- url: string,
2288
- /** @docsNotRequired */
2289
- urlAfterRedirects: string,
2290
- /** @docsNotRequired */
2291
- state: RouterStateSnapshot);
2292
- /** @docsNotRequired */
2293
- toString(): string;
2294
- }
2295
- /**
2296
- * An event triggered at the start of the Guard phase of routing.
2297
- *
2298
- * @see {@link GuardsCheckEnd}
2299
- *
2300
- * @publicApi
2301
- */
2302
- declare class GuardsCheckStart extends RouterEvent {
2303
- /** @docsNotRequired */
2304
- urlAfterRedirects: string;
2305
- /** @docsNotRequired */
2306
- state: RouterStateSnapshot;
2307
- readonly type = EventType.GuardsCheckStart;
2308
- constructor(
2309
- /** @docsNotRequired */
2310
- id: number,
2311
- /** @docsNotRequired */
2312
- url: string,
2313
- /** @docsNotRequired */
2314
- urlAfterRedirects: string,
2315
- /** @docsNotRequired */
2316
- state: RouterStateSnapshot);
2317
- toString(): string;
2318
- }
2319
- /**
2320
- * An event triggered at the end of the Guard phase of routing.
2321
- *
2322
- * @see {@link GuardsCheckStart}
2323
- *
2324
- * @publicApi
2325
- */
2326
- declare class GuardsCheckEnd extends RouterEvent {
2327
- /** @docsNotRequired */
2328
- urlAfterRedirects: string;
2329
- /** @docsNotRequired */
2330
- state: RouterStateSnapshot;
2331
- /** @docsNotRequired */
2332
- shouldActivate: boolean;
2333
- readonly type = EventType.GuardsCheckEnd;
2334
- constructor(
2335
- /** @docsNotRequired */
2336
- id: number,
2337
- /** @docsNotRequired */
2338
- url: string,
2339
- /** @docsNotRequired */
2340
- urlAfterRedirects: string,
2341
- /** @docsNotRequired */
2342
- state: RouterStateSnapshot,
2343
- /** @docsNotRequired */
2344
- shouldActivate: boolean);
2345
- toString(): string;
2346
- }
2347
- /**
2348
- * An event triggered at the start of the Resolve phase of routing.
2349
- *
2350
- * Runs in the "resolve" phase whether or not there is anything to resolve.
2351
- * In future, may change to only run when there are things to be resolved.
2352
- *
2353
- * @see {@link ResolveEnd}
2354
- *
2355
- * @publicApi
2356
- */
2357
- declare class ResolveStart extends RouterEvent {
2358
- /** @docsNotRequired */
2359
- urlAfterRedirects: string;
2360
- /** @docsNotRequired */
2361
- state: RouterStateSnapshot;
2362
- readonly type = EventType.ResolveStart;
2363
- constructor(
2364
- /** @docsNotRequired */
2365
- id: number,
2366
- /** @docsNotRequired */
2367
- url: string,
2368
- /** @docsNotRequired */
2369
- urlAfterRedirects: string,
2370
- /** @docsNotRequired */
2371
- state: RouterStateSnapshot);
2372
- toString(): string;
2373
- }
2374
- /**
2375
- * An event triggered at the end of the Resolve phase of routing.
2376
- * @see {@link ResolveStart}
2377
- *
2378
- * @publicApi
2379
- */
2380
- declare class ResolveEnd extends RouterEvent {
2381
- /** @docsNotRequired */
2382
- urlAfterRedirects: string;
2383
- /** @docsNotRequired */
2384
- state: RouterStateSnapshot;
2385
- readonly type = EventType.ResolveEnd;
2386
- constructor(
2387
- /** @docsNotRequired */
2388
- id: number,
2389
- /** @docsNotRequired */
2390
- url: string,
2391
- /** @docsNotRequired */
2392
- urlAfterRedirects: string,
2393
- /** @docsNotRequired */
2394
- state: RouterStateSnapshot);
2395
- toString(): string;
2396
- }
2397
- /**
2398
- * An event triggered before lazy loading a route configuration.
2399
- *
2400
- * @see {@link RouteConfigLoadEnd}
2401
- *
2402
- * @publicApi
2403
- */
2404
- declare class RouteConfigLoadStart {
2405
- /** @docsNotRequired */
2406
- route: Route;
2407
- readonly type = EventType.RouteConfigLoadStart;
2408
- constructor(
2409
- /** @docsNotRequired */
2410
- route: Route);
2411
- toString(): string;
2412
- }
2413
- /**
2414
- * An event triggered when a route has been lazy loaded.
2415
- *
2416
- * @see {@link RouteConfigLoadStart}
2417
- *
2418
- * @publicApi
2419
- */
2420
- declare class RouteConfigLoadEnd {
2421
- /** @docsNotRequired */
2422
- route: Route;
2423
- readonly type = EventType.RouteConfigLoadEnd;
2424
- constructor(
2425
- /** @docsNotRequired */
2426
- route: Route);
2427
- toString(): string;
2428
- }
2429
- /**
2430
- * An event triggered at the start of the child-activation
2431
- * part of the Resolve phase of routing.
2432
- * @see {@link ChildActivationEnd}
2433
- * @see {@link ResolveStart}
2434
- *
2435
- * @publicApi
2436
- */
2437
- declare class ChildActivationStart {
2438
- /** @docsNotRequired */
2439
- snapshot: ActivatedRouteSnapshot;
2440
- readonly type = EventType.ChildActivationStart;
2441
- constructor(
2442
- /** @docsNotRequired */
2443
- snapshot: ActivatedRouteSnapshot);
2444
- toString(): string;
2445
- }
2446
- /**
2447
- * An event triggered at the end of the child-activation part
2448
- * of the Resolve phase of routing.
2449
- * @see {@link ChildActivationStart}
2450
- * @see {@link ResolveStart}
2451
- * @publicApi
2452
- */
2453
- declare class ChildActivationEnd {
2454
- /** @docsNotRequired */
2455
- snapshot: ActivatedRouteSnapshot;
2456
- readonly type = EventType.ChildActivationEnd;
2457
- constructor(
2458
- /** @docsNotRequired */
2459
- snapshot: ActivatedRouteSnapshot);
2460
- toString(): string;
2461
- }
2462
- /**
2463
- * An event triggered at the start of the activation part
2464
- * of the Resolve phase of routing.
2465
- * @see {@link ActivationEnd}
2466
- * @see {@link ResolveStart}
2467
- *
2468
- * @publicApi
2469
- */
2470
- declare class ActivationStart {
2471
- /** @docsNotRequired */
2472
- snapshot: ActivatedRouteSnapshot;
2473
- readonly type = EventType.ActivationStart;
2474
- constructor(
2475
- /** @docsNotRequired */
2476
- snapshot: ActivatedRouteSnapshot);
2477
- toString(): string;
2478
- }
2479
- /**
2480
- * An event triggered at the end of the activation part
2481
- * of the Resolve phase of routing.
2482
- * @see {@link ActivationStart}
2483
- * @see {@link ResolveStart}
2484
- *
2485
- * @publicApi
2486
- */
2487
- declare class ActivationEnd {
2488
- /** @docsNotRequired */
2489
- snapshot: ActivatedRouteSnapshot;
2490
- readonly type = EventType.ActivationEnd;
2491
- constructor(
2492
- /** @docsNotRequired */
2493
- snapshot: ActivatedRouteSnapshot);
2494
- toString(): string;
2495
- }
2496
- /**
2497
- * An event triggered by scrolling.
2498
- *
2499
- * @publicApi
2500
- */
2501
- declare class Scroll {
2502
- /** @docsNotRequired */
2503
- readonly routerEvent: NavigationEnd | NavigationSkipped;
2504
- /** @docsNotRequired */
2505
- readonly position: [number, number] | null;
2506
- /** @docsNotRequired */
2507
- readonly anchor: string | null;
2508
- readonly type = EventType.Scroll;
2509
- constructor(
2510
- /** @docsNotRequired */
2511
- routerEvent: NavigationEnd | NavigationSkipped,
2512
- /** @docsNotRequired */
2513
- position: [number, number] | null,
2514
- /** @docsNotRequired */
2515
- anchor: string | null);
2516
- toString(): string;
2517
- }
2518
- /**
2519
- * Router events that allow you to track the lifecycle of the router.
2520
- *
2521
- * The events occur in the following sequence:
2522
- *
2523
- * * [NavigationStart](api/router/NavigationStart): Navigation starts.
2524
- * * [RouteConfigLoadStart](api/router/RouteConfigLoadStart): Before
2525
- * the router [lazy loads](guide/routing/common-router-tasks#lazy-loading) a route configuration.
2526
- * * [RouteConfigLoadEnd](api/router/RouteConfigLoadEnd): After a route has been lazy loaded.
2527
- * * [RoutesRecognized](api/router/RoutesRecognized): When the router parses the URL
2528
- * and the routes are recognized.
2529
- * * [GuardsCheckStart](api/router/GuardsCheckStart): When the router begins the *guards*
2530
- * phase of routing.
2531
- * * [ChildActivationStart](api/router/ChildActivationStart): When the router
2532
- * begins activating a route's children.
2533
- * * [ActivationStart](api/router/ActivationStart): When the router begins activating a route.
2534
- * * [GuardsCheckEnd](api/router/GuardsCheckEnd): When the router finishes the *guards*
2535
- * phase of routing successfully.
2536
- * * [ResolveStart](api/router/ResolveStart): When the router begins the *resolve*
2537
- * phase of routing.
2538
- * * [ResolveEnd](api/router/ResolveEnd): When the router finishes the *resolve*
2539
- * phase of routing successfully.
2540
- * * [ChildActivationEnd](api/router/ChildActivationEnd): When the router finishes
2541
- * activating a route's children.
2542
- * * [ActivationEnd](api/router/ActivationEnd): When the router finishes activating a route.
2543
- * * [NavigationEnd](api/router/NavigationEnd): When navigation ends successfully.
2544
- * * [NavigationCancel](api/router/NavigationCancel): When navigation is canceled.
2545
- * * [NavigationError](api/router/NavigationError): When navigation fails
2546
- * due to an unexpected error.
2547
- * * [Scroll](api/router/Scroll): When the user scrolls.
2548
- *
2549
- * @publicApi
2550
- */
2551
- type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError | RoutesRecognized | GuardsCheckStart | GuardsCheckEnd | RouteConfigLoadStart | RouteConfigLoadEnd | ChildActivationStart | ChildActivationEnd | ActivationStart | ActivationEnd | Scroll | ResolveStart | ResolveEnd | NavigationSkipped;
2552
-
2553
- /**
2554
- * @description
2555
- *
2556
- * Represents the detached route tree.
2557
- *
2558
- * This is an opaque value the router will give to a custom route reuse strategy
2559
- * to store and retrieve later on.
2560
- *
2561
- * @publicApi
2562
- */
2563
- type DetachedRouteHandle = {};
2564
- /**
2565
- * @description
2566
- *
2567
- * Provides a way to customize when activated routes get reused.
2568
- *
2569
- * @publicApi
2570
- */
2571
- declare abstract class RouteReuseStrategy {
2572
- /** Determines if this route (and its subtree) should be detached to be reused later */
2573
- abstract shouldDetach(route: ActivatedRouteSnapshot): boolean;
2574
- /**
2575
- * Stores the detached route.
2576
- *
2577
- * Storing a `null` value should erase the previously stored value.
2578
- */
2579
- abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle | null): void;
2580
- /** Determines if this route (and its subtree) should be reattached */
2581
- abstract shouldAttach(route: ActivatedRouteSnapshot): boolean;
2582
- /** Retrieves the previously stored route */
2583
- abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null;
2584
- /** Determines if a route should be reused */
2585
- abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean;
2586
- static ɵfac: i0.ɵɵFactoryDeclaration<RouteReuseStrategy, never>;
2587
- static ɵprov: i0.ɵɵInjectableDeclaration<RouteReuseStrategy>;
2588
- }
2589
- /**
2590
- * @description
2591
- *
2592
- * This base route reuse strategy only reuses routes when the matched router configs are
2593
- * identical. This prevents components from being destroyed and recreated
2594
- * when just the route parameters, query parameters or fragment change
2595
- * (that is, the existing component is _reused_).
2596
- *
2597
- * This strategy does not store any routes for later reuse.
2598
- *
2599
- * Angular uses this strategy by default.
2600
- *
2601
- *
2602
- * It can be used as a base class for custom route reuse strategies, i.e. you can create your own
2603
- * class that extends the `BaseRouteReuseStrategy` one.
2604
- * @publicApi
2605
- */
2606
- declare abstract class BaseRouteReuseStrategy implements RouteReuseStrategy {
2607
- /**
2608
- * Whether the given route should detach for later reuse.
2609
- * Always returns false for `BaseRouteReuseStrategy`.
2610
- * */
2611
- shouldDetach(route: ActivatedRouteSnapshot): boolean;
2612
- /**
2613
- * A no-op; the route is never stored since this strategy never detaches routes for later re-use.
2614
- */
2615
- store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void;
2616
- /** Returns `false`, meaning the route (and its subtree) is never reattached */
2617
- shouldAttach(route: ActivatedRouteSnapshot): boolean;
2618
- /** Returns `null` because this strategy does not store routes for later re-use. */
2619
- retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null;
2620
- /**
2621
- * Determines if a route should be reused.
2622
- * This strategy returns `true` when the future route config and current route config are
2623
- * identical.
2624
- */
2625
- shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean;
2626
- }
2627
-
2628
- /**
2629
- * An `InjectionToken` provided by the `RouterOutlet` and can be set using the `routerOutletData`
2630
- * input.
2631
- *
2632
- * When unset, this value is `null` by default.
2633
- *
2634
- * @usageNotes
2635
- *
2636
- * To set the data from the template of the component with `router-outlet`:
2637
- * ```html
2638
- * <router-outlet [routerOutletData]="{name: 'Angular'}" />
2639
- * ```
2640
- *
2641
- * To read the data in the routed component:
2642
- * ```ts
2643
- * data = inject(ROUTER_OUTLET_DATA) as Signal<{name: string}>;
2644
- * ```
2645
- *
2646
- * @publicApi
2647
- */
2648
- declare const ROUTER_OUTLET_DATA: InjectionToken<Signal<unknown>>;
2649
- /**
2650
- * An interface that defines the contract for developing a component outlet for the `Router`.
2651
- *
2652
- * An outlet acts as a placeholder that Angular dynamically fills based on the current router state.
2653
- *
2654
- * A router outlet should register itself with the `Router` via
2655
- * `ChildrenOutletContexts#onChildOutletCreated` and unregister with
2656
- * `ChildrenOutletContexts#onChildOutletDestroyed`. When the `Router` identifies a matched `Route`,
2657
- * it looks for a registered outlet in the `ChildrenOutletContexts` and activates it.
2658
- *
2659
- * @see {@link ChildrenOutletContexts}
2660
- * @publicApi
2661
- */
2662
- interface RouterOutletContract {
2663
- /**
2664
- * Whether the given outlet is activated.
2665
- *
2666
- * An outlet is considered "activated" if it has an active component.
2667
- */
2668
- isActivated: boolean;
2669
- /** The instance of the activated component or `null` if the outlet is not activated. */
2670
- component: Object | null;
2671
- /**
2672
- * The `Data` of the `ActivatedRoute` snapshot.
2673
- */
2674
- activatedRouteData: Data;
2675
- /**
2676
- * The `ActivatedRoute` for the outlet or `null` if the outlet is not activated.
2677
- */
2678
- activatedRoute: ActivatedRoute | null;
2679
- /**
2680
- * Called by the `Router` when the outlet should activate (create a component).
2681
- */
2682
- activateWith(activatedRoute: ActivatedRoute, environmentInjector: EnvironmentInjector): void;
2683
- /**
2684
- * A request to destroy the currently activated component.
2685
- *
2686
- * When a `RouteReuseStrategy` indicates that an `ActivatedRoute` should be removed but stored for
2687
- * later re-use rather than destroyed, the `Router` will call `detach` instead.
2688
- */
2689
- deactivate(): void;
2690
- /**
2691
- * Called when the `RouteReuseStrategy` instructs to detach the subtree.
2692
- *
2693
- * This is similar to `deactivate`, but the activated component should _not_ be destroyed.
2694
- * Instead, it is returned so that it can be reattached later via the `attach` method.
2695
- */
2696
- detach(): ComponentRef<unknown>;
2697
- /**
2698
- * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree.
2699
- */
2700
- attach(ref: ComponentRef<unknown>, activatedRoute: ActivatedRoute): void;
2701
- /**
2702
- * Emits an activate event when a new component is instantiated
2703
- **/
2704
- activateEvents?: EventEmitter<unknown>;
2705
- /**
2706
- * Emits a deactivate event when a component is destroyed.
2707
- */
2708
- deactivateEvents?: EventEmitter<unknown>;
2709
- /**
2710
- * Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a
2711
- * previously detached subtree.
2712
- **/
2713
- attachEvents?: EventEmitter<unknown>;
2714
- /**
2715
- * Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the
2716
- * subtree.
2717
- */
2718
- detachEvents?: EventEmitter<unknown>;
2719
- /**
2720
- * Used to indicate that the outlet is able to bind data from the `Router` to the outlet
2721
- * component's inputs.
2722
- *
2723
- * When this is `undefined` or `false` and the developer has opted in to the
2724
- * feature using `withComponentInputBinding`, a warning will be logged in dev mode if this outlet
2725
- * is used in the application.
2726
- */
2727
- readonly supportsBindingToComponentInputs?: true;
2728
- }
2729
- /**
2730
- * @description
2731
- *
2732
- * Acts as a placeholder that Angular dynamically fills based on the current router state.
2733
- *
2734
- * Each outlet can have a unique name, determined by the optional `name` attribute.
2735
- * The name cannot be set or changed dynamically. If not set, default value is "primary".
2736
- *
2737
- * ```html
2738
- * <router-outlet></router-outlet>
2739
- * <router-outlet name='left'></router-outlet>
2740
- * <router-outlet name='right'></router-outlet>
2741
- * ```
2742
- *
2743
- * Named outlets can be the targets of secondary routes.
2744
- * The `Route` object for a secondary route has an `outlet` property to identify the target outlet:
2745
- *
2746
- * `{path: <base-path>, component: <component>, outlet: <target_outlet_name>}`
2747
- *
2748
- * Using named outlets and secondary routes, you can target multiple outlets in
2749
- * the same `RouterLink` directive.
2750
- *
2751
- * The router keeps track of separate branches in a navigation tree for each named outlet and
2752
- * generates a representation of that tree in the URL.
2753
- * The URL for a secondary route uses the following syntax to specify both the primary and secondary
2754
- * routes at the same time:
2755
- *
2756
- * `http://base-path/primary-route-path(outlet-name:route-path)`
2757
- *
2758
- * A router outlet emits an activate event when a new component is instantiated,
2759
- * deactivate event when a component is destroyed.
2760
- * An attached event emits when the `RouteReuseStrategy` instructs the outlet to reattach the
2761
- * subtree, and the detached event emits when the `RouteReuseStrategy` instructs the outlet to
2762
- * detach the subtree.
2763
- *
2764
- * ```html
2765
- * <router-outlet
2766
- * (activate)='onActivate($event)'
2767
- * (deactivate)='onDeactivate($event)'
2768
- * (attach)='onAttach($event)'
2769
- * (detach)='onDetach($event)'></router-outlet>
2770
- * ```
2771
- *
2772
- * @see {@link RouterLink}
2773
- * @see {@link Route}
2774
- * @ngModule RouterModule
2775
- *
2776
- * @publicApi
2777
- */
2778
- declare class RouterOutlet implements OnDestroy, OnInit, RouterOutletContract {
2779
- private activated;
2780
- private _activatedRoute;
2781
- /**
2782
- * The name of the outlet
2783
- *
2784
- */
2785
- name: string;
2786
- activateEvents: EventEmitter<any>;
2787
- deactivateEvents: EventEmitter<any>;
2788
- /**
2789
- * Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a
2790
- * previously detached subtree.
2791
- **/
2792
- attachEvents: EventEmitter<unknown>;
2793
- /**
2794
- * Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the
2795
- * subtree.
2796
- */
2797
- detachEvents: EventEmitter<unknown>;
2798
- /**
2799
- * Data that will be provided to the child injector through the `ROUTER_OUTLET_DATA` token.
2800
- *
2801
- * When unset, the value of the token is `undefined` by default.
2802
- */
2803
- readonly routerOutletData: i0.InputSignal<unknown>;
2804
- private parentContexts;
2805
- private location;
2806
- private changeDetector;
2807
- private inputBinder;
2808
- /** @nodoc */
2809
- readonly supportsBindingToComponentInputs = true;
2810
- /** @nodoc */
2811
- ngOnChanges(changes: SimpleChanges): void;
2812
- /** @nodoc */
2813
- ngOnDestroy(): void;
2814
- private isTrackedInParentContexts;
2815
- /** @nodoc */
2816
- ngOnInit(): void;
2817
- private initializeOutletWithName;
2818
- get isActivated(): boolean;
2819
- /**
2820
- * @returns The currently activated component instance.
2821
- * @throws An error if the outlet is not activated.
2822
- */
2823
- get component(): Object;
2824
- get activatedRoute(): ActivatedRoute;
2825
- get activatedRouteData(): Data;
2826
- /**
2827
- * Called when the `RouteReuseStrategy` instructs to detach the subtree
2828
- */
2829
- detach(): ComponentRef<any>;
2830
- /**
2831
- * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
2832
- */
2833
- attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute): void;
2834
- deactivate(): void;
2835
- activateWith(activatedRoute: ActivatedRoute, environmentInjector: EnvironmentInjector): void;
2836
- static ɵfac: i0.ɵɵFactoryDeclaration<RouterOutlet, never>;
2837
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterOutlet, "router-outlet", ["outlet"], { "name": { "alias": "name"; "required": false; }; "routerOutletData": { "alias": "routerOutletData"; "required": false; "isSignal": true; }; }, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; "attachEvents": "attach"; "detachEvents": "detach"; }, never, never, true, never>;
2838
- }
2839
-
2840
- /**
2841
- * Store contextual information about a `RouterOutlet`
2842
- *
2843
- * @publicApi
2844
- */
2845
- declare class OutletContext {
2846
- private readonly rootInjector;
2847
- outlet: RouterOutletContract | null;
2848
- route: ActivatedRoute | null;
2849
- children: ChildrenOutletContexts;
2850
- attachRef: ComponentRef<any> | null;
2851
- get injector(): EnvironmentInjector;
2852
- constructor(rootInjector: EnvironmentInjector);
2853
- }
2854
- /**
2855
- * Store contextual information about the children (= nested) `RouterOutlet`
2856
- *
2857
- * @publicApi
2858
- */
2859
- declare class ChildrenOutletContexts {
2860
- private rootInjector;
2861
- private contexts;
2862
- /** @nodoc */
2863
- constructor(rootInjector: EnvironmentInjector);
2864
- /** Called when a `RouterOutlet` directive is instantiated */
2865
- onChildOutletCreated(childName: string, outlet: RouterOutletContract): void;
2866
- /**
2867
- * Called when a `RouterOutlet` directive is destroyed.
2868
- * We need to keep the context as the outlet could be destroyed inside a NgIf and might be
2869
- * re-created later.
2870
- */
2871
- onChildOutletDestroyed(childName: string): void;
2872
- /**
2873
- * Called when the corresponding route is deactivated during navigation.
2874
- * Because the component get destroyed, all children outlet are destroyed.
2875
- */
2876
- onOutletDeactivated(): Map<string, OutletContext>;
2877
- onOutletReAttached(contexts: Map<string, OutletContext>): void;
2878
- getOrCreateContext(childName: string): OutletContext;
2879
- getContext(childName: string): OutletContext | null;
2880
- static ɵfac: i0.ɵɵFactoryDeclaration<ChildrenOutletContexts, never>;
2881
- static ɵprov: i0.ɵɵInjectableDeclaration<ChildrenOutletContexts>;
2882
- }
2883
-
2884
- /**
2885
- * @description
2886
- *
2887
- * Options that modify the `Router` URL.
2888
- * Supply an object containing any of these properties to a `Router` navigation function to
2889
- * control how the target URL should be constructed.
2890
- *
2891
- * @see {@link Router#navigate}
2892
- * @see {@link Router#createUrlTree}
2893
- * @see [Routing and Navigation guide](guide/routing/common-router-tasks)
2894
- *
2895
- * @publicApi
2896
- */
2897
- interface UrlCreationOptions {
2898
- /**
2899
- * Specifies a root URI to use for relative navigation.
2900
- *
2901
- * For example, consider the following route configuration where the parent route
2902
- * has two children.
2903
- *
2904
- * ```
2905
- * [{
2906
- * path: 'parent',
2907
- * component: ParentComponent,
2908
- * children: [{
2909
- * path: 'list',
2910
- * component: ListComponent
2911
- * },{
2912
- * path: 'child',
2913
- * component: ChildComponent
2914
- * }]
2915
- * }]
2916
- * ```
2917
- *
2918
- * The following `go()` function navigates to the `list` route by
2919
- * interpreting the destination URI as relative to the activated `child` route
2920
- *
2921
- * ```ts
2922
- * @Component({...})
2923
- * class ChildComponent {
2924
- * constructor(private router: Router, private route: ActivatedRoute) {}
2925
- *
2926
- * go() {
2927
- * router.navigate(['../list'], { relativeTo: this.route });
2928
- * }
2929
- * }
2930
- * ```
2931
- *
2932
- * A value of `null` or `undefined` indicates that the navigation commands should be applied
2933
- * relative to the root.
2934
- */
2935
- relativeTo?: ActivatedRoute | null;
2936
- /**
2937
- * Sets query parameters to the URL.
2938
- *
2939
- * ```
2940
- * // Navigate to /results?page=1
2941
- * router.navigate(['/results'], { queryParams: { page: 1 } });
2942
- * ```
2943
- */
2944
- queryParams?: Params | null;
2945
- /**
2946
- * Sets the hash fragment for the URL.
2947
- *
2948
- * ```
2949
- * // Navigate to /results#top
2950
- * router.navigate(['/results'], { fragment: 'top' });
2951
- * ```
2952
- */
2953
- fragment?: string;
2954
- /**
2955
- * How to handle query parameters in the router link for the next navigation.
2956
- * One of:
2957
- * * `preserve` : Preserve current parameters.
2958
- * * `merge` : Merge new with current parameters.
2959
- *
2960
- * The "preserve" option discards any new query params:
2961
- * ```
2962
- * // from /view1?page=1 to/view2?page=1
2963
- * router.navigate(['/view2'], { queryParams: { page: 2 }, queryParamsHandling: "preserve"
2964
- * });
2965
- * ```
2966
- * The "merge" option appends new query params to the params from the current URL:
2967
- * ```
2968
- * // from /view1?page=1 to/view2?page=1&otherKey=2
2969
- * router.navigate(['/view2'], { queryParams: { otherKey: 2 }, queryParamsHandling: "merge"
2970
- * });
2971
- * ```
2972
- * In case of a key collision between current parameters and those in the `queryParams` object,
2973
- * the new value is used.
2974
- *
2975
- */
2976
- queryParamsHandling?: QueryParamsHandling | null;
2977
- /**
2978
- * When true, preserves the URL fragment for the next navigation
2979
- *
2980
- * ```
2981
- * // Preserve fragment from /results#top to /view#top
2982
- * router.navigate(['/view'], { preserveFragment: true });
2983
- * ```
2984
- */
2985
- preserveFragment?: boolean;
2986
- }
2987
- /**
2988
- * @description
2989
- *
2990
- * Options that modify the `Router` navigation strategy.
2991
- * Supply an object containing any of these properties to a `Router` navigation function to
2992
- * control how the target URL should be constructed or interpreted.
2993
- *
2994
- * @see {@link Router#navigate}
2995
- * @see {@link Router#navigateByUrl}
2996
- * @see {@link Router#createurltree}
2997
- * @see [Routing and Navigation guide](guide/routing/common-router-tasks)
2998
- * @see {@link UrlCreationOptions}
2999
- * @see {@link NavigationBehaviorOptions}
3000
- *
3001
- * @publicApi
3002
- */
3003
- interface NavigationExtras extends UrlCreationOptions, NavigationBehaviorOptions {
3004
- }
3005
- type RestoredState = {
3006
- [k: string]: any;
3007
- navigationId: number;
3008
- ɵrouterPageId?: number;
3009
- };
3010
- /**
3011
- * Information about a navigation operation.
3012
- * Retrieve the most recent navigation object with the
3013
- * [Router.getCurrentNavigation() method](api/router/Router#getcurrentnavigation) .
3014
- *
3015
- * * *id* : The unique identifier of the current navigation.
3016
- * * *initialUrl* : The target URL passed into the `Router#navigateByUrl()` call before navigation.
3017
- * This is the value before the router has parsed or applied redirects to it.
3018
- * * *extractedUrl* : The initial target URL after being parsed with `UrlSerializer.extract()`.
3019
- * * *finalUrl* : The extracted URL after redirects have been applied.
3020
- * This URL may not be available immediately, therefore this property can be `undefined`.
3021
- * It is guaranteed to be set after the `RoutesRecognized` event fires.
3022
- * * *trigger* : Identifies how this navigation was triggered.
3023
- * -- 'imperative'--Triggered by `router.navigateByUrl` or `router.navigate`.
3024
- * -- 'popstate'--Triggered by a popstate event.
3025
- * -- 'hashchange'--Triggered by a hashchange event.
3026
- * * *extras* : A `NavigationExtras` options object that controlled the strategy used for this
3027
- * navigation.
3028
- * * *previousNavigation* : The previously successful `Navigation` object. Only one previous
3029
- * navigation is available, therefore this previous `Navigation` object has a `null` value for its
3030
- * own `previousNavigation`.
3031
- *
3032
- * @publicApi
3033
- */
3034
- interface Navigation {
3035
- /**
3036
- * The unique identifier of the current navigation.
3037
- */
3038
- id: number;
3039
- /**
3040
- * The target URL passed into the `Router#navigateByUrl()` call before navigation. This is
3041
- * the value before the router has parsed or applied redirects to it.
3042
- */
3043
- initialUrl: UrlTree;
3044
- /**
3045
- * The initial target URL after being parsed with `UrlHandlingStrategy.extract()`.
3046
- */
3047
- extractedUrl: UrlTree;
3048
- /**
3049
- * The extracted URL after redirects have been applied.
3050
- * This URL may not be available immediately, therefore this property can be `undefined`.
3051
- * It is guaranteed to be set after the `RoutesRecognized` event fires.
3052
- */
3053
- finalUrl?: UrlTree;
3054
- /**
3055
- * Identifies how this navigation was triggered.
3056
- *
3057
- * * 'imperative'--Triggered by `router.navigateByUrl` or `router.navigate`.
3058
- * * 'popstate'--Triggered by a popstate event.
3059
- * * 'hashchange'--Triggered by a hashchange event.
3060
- */
3061
- trigger: 'imperative' | 'popstate' | 'hashchange';
3062
- /**
3063
- * Options that controlled the strategy used for this navigation.
3064
- * See `NavigationExtras`.
3065
- */
3066
- extras: NavigationExtras;
3067
- /**
3068
- * The previously successful `Navigation` object. Only one previous navigation
3069
- * is available, therefore this previous `Navigation` object has a `null` value
3070
- * for its own `previousNavigation`.
3071
- */
3072
- previousNavigation: Navigation | null;
3073
- }
3074
-
3075
- /**
3076
- * @description
3077
- *
3078
- * A service that facilitates navigation among views and URL manipulation capabilities.
3079
- * This service is provided in the root scope and configured with [provideRouter](api/router/provideRouter).
3080
- *
3081
- * @see {@link Route}
3082
- * @see {@link provideRouter}
3083
- * @see [Routing and Navigation Guide](guide/routing/common-router-tasks).
3084
- *
3085
- * @ngModule RouterModule
3086
- *
3087
- * @publicApi
3088
- */
3089
- declare class Router {
3090
- private get currentUrlTree();
3091
- private get rawUrlTree();
3092
- private disposed;
3093
- private nonRouterCurrentEntryChangeSubscription?;
3094
- private readonly console;
3095
- private readonly stateManager;
3096
- private readonly options;
3097
- private readonly pendingTasks;
3098
- private readonly urlUpdateStrategy;
3099
- private readonly navigationTransitions;
3100
- private readonly urlSerializer;
3101
- private readonly location;
3102
- private readonly urlHandlingStrategy;
3103
- /**
3104
- * The private `Subject` type for the public events exposed in the getter. This is used internally
3105
- * to push events to. The separate field allows us to expose separate types in the public API
3106
- * (i.e., an Observable rather than the Subject).
3107
- */
3108
- private _events;
3109
- /**
3110
- * An event stream for routing events.
3111
- */
3112
- get events(): Observable<Event>;
3113
- /**
3114
- * The current state of routing in this NgModule.
3115
- */
3116
- get routerState(): _angular_router.RouterState;
3117
- /**
3118
- * True if at least one navigation event has occurred,
3119
- * false otherwise.
3120
- */
3121
- navigated: boolean;
3122
- /**
3123
- * A strategy for re-using routes.
3124
- *
3125
- * @deprecated Configure using `providers` instead:
3126
- * `{provide: RouteReuseStrategy, useClass: MyStrategy}`.
3127
- */
3128
- routeReuseStrategy: RouteReuseStrategy;
3129
- /**
3130
- * How to handle a navigation request to the current URL.
3131
- *
3132
- *
3133
- * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
3134
- * @see {@link withRouterConfig}
3135
- * @see {@link provideRouter}
3136
- * @see {@link RouterModule}
3137
- */
3138
- onSameUrlNavigation: OnSameUrlNavigation;
3139
- config: Routes;
3140
- /**
3141
- * Indicates whether the application has opted in to binding Router data to component inputs.
3142
- *
3143
- * This option is enabled by the `withComponentInputBinding` feature of `provideRouter` or
3144
- * `bindToComponentInputs` in the `ExtraOptions` of `RouterModule.forRoot`.
3145
- */
3146
- readonly componentInputBindingEnabled: boolean;
3147
- constructor();
3148
- private eventsSubscription;
3149
- private subscribeToNavigationEvents;
3150
- /**
3151
- * Sets up the location change listener and performs the initial navigation.
3152
- */
3153
- initialNavigation(): void;
3154
- /**
3155
- * Sets up the location change listener. This listener detects navigations triggered from outside
3156
- * the Router (the browser back/forward buttons, for example) and schedules a corresponding Router
3157
- * navigation so that the correct events, guards, etc. are triggered.
3158
- */
3159
- setUpLocationChangeListener(): void;
3160
- /**
3161
- * Schedules a router navigation to synchronize Router state with the browser state.
3162
- *
3163
- * This is done as a response to a popstate event and the initial navigation. These
3164
- * two scenarios represent times when the browser URL/state has been updated and
3165
- * the Router needs to respond to ensure its internal state matches.
3166
- */
3167
- private navigateToSyncWithBrowser;
3168
- /** The current URL. */
3169
- get url(): string;
3170
- /**
3171
- * Returns the current `Navigation` object when the router is navigating,
3172
- * and `null` when idle.
3173
- */
3174
- getCurrentNavigation(): Navigation | null;
3175
- /**
3176
- * The `Navigation` object of the most recent navigation to succeed and `null` if there
3177
- * has not been a successful navigation yet.
3178
- */
3179
- get lastSuccessfulNavigation(): Navigation | null;
3180
- /**
3181
- * Resets the route configuration used for navigation and generating links.
3182
- *
3183
- * @param config The route array for the new configuration.
3184
- *
3185
- * @usageNotes
3186
- *
3187
- * ```ts
3188
- * router.resetConfig([
3189
- * { path: 'team/:id', component: TeamCmp, children: [
3190
- * { path: 'simple', component: SimpleCmp },
3191
- * { path: 'user/:name', component: UserCmp }
3192
- * ]}
3193
- * ]);
3194
- * ```
3195
- */
3196
- resetConfig(config: Routes): void;
3197
- /** @nodoc */
3198
- ngOnDestroy(): void;
3199
- /** Disposes of the router. */
3200
- dispose(): void;
3201
- /**
3202
- * Appends URL segments to the current URL tree to create a new URL tree.
3203
- *
3204
- * @param commands An array of URL fragments with which to construct the new URL tree.
3205
- * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
3206
- * segments, followed by the parameters for each segment.
3207
- * The fragments are applied to the current URL tree or the one provided in the `relativeTo`
3208
- * property of the options object, if supplied.
3209
- * @param navigationExtras Options that control the navigation strategy.
3210
- * @returns The new URL tree.
3211
- *
3212
- * @usageNotes
3213
- *
3214
- * ```
3215
- * // create /team/33/user/11
3216
- * router.createUrlTree(['/team', 33, 'user', 11]);
3217
- *
3218
- * // create /team/33;expand=true/user/11
3219
- * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);
3220
- *
3221
- * // you can collapse static segments like this (this works only with the first passed-in value):
3222
- * router.createUrlTree(['/team/33/user', userId]);
3223
- *
3224
- * // If the first segment can contain slashes, and you do not want the router to split it,
3225
- * // you can do the following:
3226
- * router.createUrlTree([{segmentPath: '/one/two'}]);
3227
- *
3228
- * // create /team/33/(user/11//right:chat)
3229
- * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);
3230
- *
3231
- * // remove the right secondary node
3232
- * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
3233
- *
3234
- * // assuming the current url is `/team/33/user/11` and the route points to `user/11`
3235
- *
3236
- * // navigate to /team/33/user/11/details
3237
- * router.createUrlTree(['details'], {relativeTo: route});
3238
- *
3239
- * // navigate to /team/33/user/22
3240
- * router.createUrlTree(['../22'], {relativeTo: route});
3241
- *
3242
- * // navigate to /team/44/user/22
3243
- * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});
3244
- *
3245
- * Note that a value of `null` or `undefined` for `relativeTo` indicates that the
3246
- * tree should be created relative to the root.
3247
- * ```
3248
- */
3249
- createUrlTree(commands: any[], navigationExtras?: UrlCreationOptions): UrlTree;
3250
- /**
3251
- * Navigates to a view using an absolute route path.
3252
- *
3253
- * @param url An absolute path for a defined route. The function does not apply any delta to the
3254
- * current URL.
3255
- * @param extras An object containing properties that modify the navigation strategy.
3256
- *
3257
- * @returns A Promise that resolves to 'true' when navigation succeeds,
3258
- * to 'false' when navigation fails, or is rejected on error.
3259
- *
3260
- * @usageNotes
3261
- *
3262
- * The following calls request navigation to an absolute path.
3263
- *
3264
- * ```ts
3265
- * router.navigateByUrl("/team/33/user/11");
3266
- *
3267
- * // Navigate without updating the URL
3268
- * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
3269
- * ```
3270
- *
3271
- * @see [Routing and Navigation guide](guide/routing/common-router-tasks)
3272
- *
3273
- */
3274
- navigateByUrl(url: string | UrlTree, extras?: NavigationBehaviorOptions): Promise<boolean>;
3275
- /**
3276
- * Navigate based on the provided array of commands and a starting point.
3277
- * If no starting route is provided, the navigation is absolute.
3278
- *
3279
- * @param commands An array of URL fragments with which to construct the target URL.
3280
- * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
3281
- * segments, followed by the parameters for each segment.
3282
- * The fragments are applied to the current URL or the one provided in the `relativeTo` property
3283
- * of the options object, if supplied.
3284
- * @param extras An options object that determines how the URL should be constructed or
3285
- * interpreted.
3286
- *
3287
- * @returns A Promise that resolves to `true` when navigation succeeds, or `false` when navigation
3288
- * fails. The Promise is rejected when an error occurs if `resolveNavigationPromiseOnError` is
3289
- * not `true`.
3290
- *
3291
- * @usageNotes
3292
- *
3293
- * The following calls request navigation to a dynamic route path relative to the current URL.
3294
- *
3295
- * ```ts
3296
- * router.navigate(['team', 33, 'user', 11], {relativeTo: route});
3297
- *
3298
- * // Navigate without updating the URL, overriding the default behavior
3299
- * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});
3300
- * ```
3301
- *
3302
- * @see [Routing and Navigation guide](guide/routing/common-router-tasks)
3303
- *
3304
- */
3305
- navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>;
3306
- /** Serializes a `UrlTree` into a string */
3307
- serializeUrl(url: UrlTree): string;
3308
- /** Parses a string into a `UrlTree` */
3309
- parseUrl(url: string): UrlTree;
3310
- /**
3311
- * Returns whether the url is activated.
3312
- *
3313
- * @deprecated
3314
- * Use `IsActiveMatchOptions` instead.
3315
- *
3316
- * - The equivalent `IsActiveMatchOptions` for `true` is
3317
- * `{paths: 'exact', queryParams: 'exact', fragment: 'ignored', matrixParams: 'ignored'}`.
3318
- * - The equivalent for `false` is
3319
- * `{paths: 'subset', queryParams: 'subset', fragment: 'ignored', matrixParams: 'ignored'}`.
3320
- */
3321
- isActive(url: string | UrlTree, exact: boolean): boolean;
3322
- /**
3323
- * Returns whether the url is activated.
3324
- */
3325
- isActive(url: string | UrlTree, matchOptions: IsActiveMatchOptions): boolean;
3326
- private removeEmptyProps;
3327
- private scheduleNavigation;
3328
- static ɵfac: i0.ɵɵFactoryDeclaration<Router, never>;
3329
- static ɵprov: i0.ɵɵInjectableDeclaration<Router>;
3330
- }
3331
-
3332
- /**
3333
- * @description
3334
- *
3335
- * When applied to an element in a template, makes that element a link
3336
- * that initiates navigation to a route. Navigation opens one or more routed components
3337
- * in one or more `<router-outlet>` locations on the page.
3338
- *
3339
- * Given a route configuration `[{ path: 'user/:name', component: UserCmp }]`,
3340
- * the following creates a static link to the route:
3341
- * `<a routerLink="/user/bob">link to user component</a>`
3342
- *
3343
- * You can use dynamic values to generate the link.
3344
- * For a dynamic link, pass an array of path segments,
3345
- * followed by the params for each segment.
3346
- * For example, `['/team', teamId, 'user', userName, {details: true}]`
3347
- * generates a link to `/team/11/user/bob;details=true`.
3348
- *
3349
- * Multiple static segments can be merged into one term and combined with dynamic segments.
3350
- * For example, `['/team/11/user', userName, {details: true}]`
3351
- *
3352
- * The input that you provide to the link is treated as a delta to the current URL.
3353
- * For instance, suppose the current URL is `/user/(box//aux:team)`.
3354
- * The link `<a [routerLink]="['/user/jim']">Jim</a>` creates the URL
3355
- * `/user/(jim//aux:team)`.
3356
- * See {@link Router#createUrlTree} for more information.
3357
- *
3358
- * @usageNotes
3359
- *
3360
- * You can use absolute or relative paths in a link, set query parameters,
3361
- * control how parameters are handled, and keep a history of navigation states.
3362
- *
3363
- * ### Relative link paths
3364
- *
3365
- * The first segment name can be prepended with `/`, `./`, or `../`.
3366
- * * If the first segment begins with `/`, the router looks up the route from the root of the
3367
- * app.
3368
- * * If the first segment begins with `./`, or doesn't begin with a slash, the router
3369
- * looks in the children of the current activated route.
3370
- * * If the first segment begins with `../`, the router goes up one level in the route tree.
3371
- *
3372
- * ### Setting and handling query params and fragments
3373
20
  *
3374
- * The following link adds a query parameter and a fragment to the generated URL:
3375
21
  *
3376
- * ```html
3377
- * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" fragment="education">
3378
- * link to user component
3379
- * </a>
3380
- * ```
3381
- * By default, the directive constructs the new URL using the given query parameters.
3382
- * The example generates the link: `/user/bob?debug=true#education`.
22
+ * @param relativeTo The `ActivatedRouteSnapshot` to apply the commands to
23
+ * @param commands An array of URL fragments with which to construct the new URL tree.
24
+ * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
25
+ * segments, followed by the parameters for each segment.
26
+ * The fragments are applied to the one provided in the `relativeTo` parameter.
27
+ * @param queryParams The query parameters for the `UrlTree`. `null` if the `UrlTree` does not have
28
+ * any query parameters.
29
+ * @param fragment The fragment for the `UrlTree`. `null` if the `UrlTree` does not have a fragment.
3383
30
  *
3384
- * You can instruct the directive to handle query parameters differently
3385
- * by specifying the `queryParamsHandling` option in the link.
3386
- * Allowed values are:
31
+ * @usageNotes
3387
32
  *
3388
- * - `'merge'`: Merge the given `queryParams` into the current query params.
3389
- * - `'preserve'`: Preserve the current query params.
33
+ * ```ts
34
+ * // create /team/33/user/11
35
+ * createUrlTreeFromSnapshot(snapshot, ['/team', 33, 'user', 11]);
3390
36
  *
3391
- * For example:
37
+ * // create /team/33;expand=true/user/11
38
+ * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {expand: true}, 'user', 11]);
3392
39
  *
3393
- * ```html
3394
- * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" queryParamsHandling="merge">
3395
- * link to user component
3396
- * </a>
3397
- * ```
40
+ * // you can collapse static segments like this (this works only with the first passed-in value):
41
+ * createUrlTreeFromSnapshot(snapshot, ['/team/33/user', userId]);
3398
42
  *
3399
- * `queryParams`, `fragment`, `queryParamsHandling`, `preserveFragment`, and `relativeTo`
3400
- * cannot be used when the `routerLink` input is a `UrlTree`.
43
+ * // If the first segment can contain slashes, and you do not want the router to split it,
44
+ * // you can do the following:
45
+ * createUrlTreeFromSnapshot(snapshot, [{segmentPath: '/one/two'}]);
3401
46
  *
3402
- * See {@link UrlCreationOptions#queryParamsHandling}.
47
+ * // create /team/33/(user/11//right:chat)
48
+ * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right:
49
+ * 'chat'}}], null, null);
3403
50
  *
3404
- * ### Preserving navigation history
51
+ * // remove the right secondary node
52
+ * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
3405
53
  *
3406
- * You can provide a `state` value to be persisted to the browser's
3407
- * [`History.state` property](https://developer.mozilla.org/en-US/docs/Web/API/History#Properties).
3408
- * For example:
54
+ * // For the examples below, assume the current URL is for the `/team/33/user/11` and the
55
+ * `ActivatedRouteSnapshot` points to `user/11`:
3409
56
  *
3410
- * ```html
3411
- * <a [routerLink]="['/user/bob']" [state]="{tracingId: 123}">
3412
- * link to user component
3413
- * </a>
3414
- * ```
57
+ * // navigate to /team/33/user/11/details
58
+ * createUrlTreeFromSnapshot(snapshot, ['details']);
3415
59
  *
3416
- * Use {@link Router#getCurrentNavigation} to retrieve a saved
3417
- * navigation-state value. For example, to capture the `tracingId` during the `NavigationStart`
3418
- * event:
60
+ * // navigate to /team/33/user/22
61
+ * createUrlTreeFromSnapshot(snapshot, ['../22']);
3419
62
  *
3420
- * ```ts
3421
- * // Get NavigationStart events
3422
- * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => {
3423
- * const navigation = router.getCurrentNavigation();
3424
- * tracingService.trace({id: navigation.extras.state.tracingId});
3425
- * });
63
+ * // navigate to /team/44/user/22
64
+ * createUrlTreeFromSnapshot(snapshot, ['../../team/44/user/22']);
3426
65
  * ```
3427
- *
3428
- * @ngModule RouterModule
66
+ */
67
+ declare function createUrlTreeFromSnapshot(relativeTo: ActivatedRouteSnapshot, commands: any[], queryParams?: Params | null, fragment?: string | null): UrlTree;
68
+
69
+ /**
70
+ * Store contextual information about a `RouterOutlet`
3429
71
  *
3430
72
  * @publicApi
3431
73
  */
3432
- declare class RouterLink implements OnChanges, OnDestroy {
3433
- private router;
3434
- private route;
3435
- private readonly tabIndexAttribute;
3436
- private readonly renderer;
3437
- private readonly el;
3438
- private locationStrategy?;
3439
- /**
3440
- * Represents an `href` attribute value applied to a host element,
3441
- * when a host element is `<a>`. For other tags, the value is `null`.
3442
- */
3443
- href: string | null;
3444
- /**
3445
- * Represents the `target` attribute on a host element.
3446
- * This is only used when the host element is an `<a>` tag.
3447
- */
3448
- target?: string;
3449
- /**
3450
- * Passed to {@link Router#createUrlTree} as part of the
3451
- * `UrlCreationOptions`.
3452
- * @see {@link UrlCreationOptions#queryParams}
3453
- * @see {@link Router#createUrlTree}
3454
- */
3455
- queryParams?: Params | null;
3456
- /**
3457
- * Passed to {@link Router#createUrlTree} as part of the
3458
- * `UrlCreationOptions`.
3459
- * @see {@link UrlCreationOptions#fragment}
3460
- * @see {@link Router#createUrlTree}
3461
- */
3462
- fragment?: string;
3463
- /**
3464
- * Passed to {@link Router#createUrlTree} as part of the
3465
- * `UrlCreationOptions`.
3466
- * @see {@link UrlCreationOptions#queryParamsHandling}
3467
- * @see {@link Router#createUrlTree}
3468
- */
3469
- queryParamsHandling?: QueryParamsHandling | null;
3470
- /**
3471
- * Passed to {@link Router#navigateByUrl} as part of the
3472
- * `NavigationBehaviorOptions`.
3473
- * @see {@link NavigationBehaviorOptions#state}
3474
- * @see {@link Router#navigateByUrl}
3475
- */
3476
- state?: {
3477
- [k: string]: any;
3478
- };
3479
- /**
3480
- * Passed to {@link Router#navigateByUrl} as part of the
3481
- * `NavigationBehaviorOptions`.
3482
- * @see {@link NavigationBehaviorOptions#info}
3483
- * @see {@link Router#navigateByUrl}
3484
- */
3485
- info?: unknown;
3486
- /**
3487
- * Passed to {@link Router#createUrlTree} as part of the
3488
- * `UrlCreationOptions`.
3489
- * Specify a value here when you do not want to use the default value
3490
- * for `routerLink`, which is the current activated route.
3491
- * Note that a value of `undefined` here will use the `routerLink` default.
3492
- * @see {@link UrlCreationOptions#relativeTo}
3493
- * @see {@link Router#createUrlTree}
3494
- */
3495
- relativeTo?: ActivatedRoute | null;
3496
- /** Whether a host element is an `<a>` tag. */
3497
- private isAnchorElement;
3498
- private subscription?;
3499
- constructor(router: Router, route: ActivatedRoute, tabIndexAttribute: string | null | undefined, renderer: Renderer2, el: ElementRef, locationStrategy?: LocationStrategy | undefined);
3500
- /**
3501
- * Passed to {@link Router#createUrlTree} as part of the
3502
- * `UrlCreationOptions`.
3503
- * @see {@link UrlCreationOptions#preserveFragment}
3504
- * @see {@link Router#createUrlTree}
3505
- */
3506
- preserveFragment: boolean;
3507
- /**
3508
- * Passed to {@link Router#navigateByUrl} as part of the
3509
- * `NavigationBehaviorOptions`.
3510
- * @see {@link NavigationBehaviorOptions#skipLocationChange}
3511
- * @see {@link Router#navigateByUrl}
3512
- */
3513
- skipLocationChange: boolean;
3514
- /**
3515
- * Passed to {@link Router#navigateByUrl} as part of the
3516
- * `NavigationBehaviorOptions`.
3517
- * @see {@link NavigationBehaviorOptions#replaceUrl}
3518
- * @see {@link Router#navigateByUrl}
3519
- */
3520
- replaceUrl: boolean;
3521
- /**
3522
- * Modifies the tab index if there was not a tabindex attribute on the element during
3523
- * instantiation.
3524
- */
3525
- private setTabIndexIfNotOnNativeEl;
3526
- /** @nodoc */
3527
- ngOnChanges(changes?: SimpleChanges): void;
3528
- private routerLinkInput;
3529
- /**
3530
- * Commands to pass to {@link Router#createUrlTree} or a `UrlTree`.
3531
- * - **array**: commands to pass to {@link Router#createUrlTree}.
3532
- * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
3533
- * - **UrlTree**: a `UrlTree` for this link rather than creating one from the commands
3534
- * and other inputs that correspond to properties of `UrlCreationOptions`.
3535
- * - **null|undefined**: effectively disables the `routerLink`
3536
- * @see {@link Router#createUrlTree}
3537
- */
3538
- set routerLink(commandsOrUrlTree: any[] | string | UrlTree | null | undefined);
3539
- /** @nodoc */
3540
- onClick(button: number, ctrlKey: boolean, shiftKey: boolean, altKey: boolean, metaKey: boolean): boolean;
3541
- /** @nodoc */
3542
- ngOnDestroy(): any;
3543
- private updateHref;
3544
- private applyAttributeValue;
3545
- get urlTree(): UrlTree | null;
3546
- static ɵfac: i0.ɵɵFactoryDeclaration<RouterLink, [null, null, { attribute: "tabindex"; }, null, null, null]>;
3547
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLink, "[routerLink]", never, { "target": { "alias": "target"; "required": false; }; "queryParams": { "alias": "queryParams"; "required": false; }; "fragment": { "alias": "fragment"; "required": false; }; "queryParamsHandling": { "alias": "queryParamsHandling"; "required": false; }; "state": { "alias": "state"; "required": false; }; "info": { "alias": "info"; "required": false; }; "relativeTo": { "alias": "relativeTo"; "required": false; }; "preserveFragment": { "alias": "preserveFragment"; "required": false; }; "skipLocationChange": { "alias": "skipLocationChange"; "required": false; }; "replaceUrl": { "alias": "replaceUrl"; "required": false; }; "routerLink": { "alias": "routerLink"; "required": false; }; }, {}, never, never, true, never>;
3548
- static ngAcceptInputType_preserveFragment: unknown;
3549
- static ngAcceptInputType_skipLocationChange: unknown;
3550
- static ngAcceptInputType_replaceUrl: unknown;
74
+ declare class OutletContext {
75
+ private readonly rootInjector;
76
+ outlet: RouterOutletContract | null;
77
+ route: ActivatedRoute | null;
78
+ children: ChildrenOutletContexts;
79
+ attachRef: ComponentRef<any> | null;
80
+ get injector(): EnvironmentInjector;
81
+ constructor(rootInjector: EnvironmentInjector);
3551
82
  }
3552
-
3553
83
  /**
3554
- *
3555
- * @description
3556
- *
3557
- * Tracks whether the linked route of an element is currently active, and allows you
3558
- * to specify one or more CSS classes to add to the element when the linked route
3559
- * is active.
3560
- *
3561
- * Use this directive to create a visual distinction for elements associated with an active route.
3562
- * For example, the following code highlights the word "Bob" when the router
3563
- * activates the associated route:
3564
- *
3565
- * ```html
3566
- * <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a>
3567
- * ```
3568
- *
3569
- * Whenever the URL is either '/user' or '/user/bob', the "active-link" class is
3570
- * added to the anchor tag. If the URL changes, the class is removed.
3571
- *
3572
- * You can set more than one class using a space-separated string or an array.
3573
- * For example:
3574
- *
3575
- * ```html
3576
- * <a routerLink="/user/bob" routerLinkActive="class1 class2">Bob</a>
3577
- * <a routerLink="/user/bob" [routerLinkActive]="['class1', 'class2']">Bob</a>
3578
- * ```
3579
- *
3580
- * To add the classes only when the URL matches the link exactly, add the option `exact: true`:
3581
- *
3582
- * ```html
3583
- * <a routerLink="/user/bob" routerLinkActive="active-link" [routerLinkActiveOptions]="{exact:
3584
- * true}">Bob</a>
3585
- * ```
3586
- *
3587
- * To directly check the `isActive` status of the link, assign the `RouterLinkActive`
3588
- * instance to a template variable.
3589
- * For example, the following checks the status without assigning any CSS classes:
3590
- *
3591
- * ```html
3592
- * <a routerLink="/user/bob" routerLinkActive #rla="routerLinkActive">
3593
- * Bob {{ rla.isActive ? '(already open)' : ''}}
3594
- * </a>
3595
- * ```
3596
- *
3597
- * You can apply the `RouterLinkActive` directive to an ancestor of linked elements.
3598
- * For example, the following sets the active-link class on the `<div>` parent tag
3599
- * when the URL is either '/user/jim' or '/user/bob'.
3600
- *
3601
- * ```html
3602
- * <div routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: true}">
3603
- * <a routerLink="/user/jim">Jim</a>
3604
- * <a routerLink="/user/bob">Bob</a>
3605
- * </div>
3606
- * ```
3607
- *
3608
- * The `RouterLinkActive` directive can also be used to set the aria-current attribute
3609
- * to provide an alternative distinction for active elements to visually impaired users.
3610
- *
3611
- * For example, the following code adds the 'active' class to the Home Page link when it is
3612
- * indeed active and in such case also sets its aria-current attribute to 'page':
3613
- *
3614
- * ```html
3615
- * <a routerLink="/" routerLinkActive="active" ariaCurrentWhenActive="page">Home Page</a>
3616
- * ```
3617
- *
3618
- * @ngModule RouterModule
84
+ * Store contextual information about the children (= nested) `RouterOutlet`
3619
85
  *
3620
86
  * @publicApi
3621
87
  */
3622
- declare class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit {
3623
- private router;
3624
- private element;
3625
- private renderer;
3626
- private readonly cdr;
3627
- private link?;
3628
- links: QueryList<RouterLink>;
3629
- private classes;
3630
- private routerEventsSubscription;
3631
- private linkInputChangesSubscription?;
3632
- private _isActive;
3633
- get isActive(): boolean;
3634
- /**
3635
- * Options to configure how to determine if the router link is active.
3636
- *
3637
- * These options are passed to the `Router.isActive()` function.
3638
- *
3639
- * @see {@link Router#isActive}
3640
- */
3641
- routerLinkActiveOptions: {
3642
- exact: boolean;
3643
- } | IsActiveMatchOptions;
88
+ declare class ChildrenOutletContexts {
89
+ private rootInjector;
90
+ private contexts;
91
+ /** @nodoc */
92
+ constructor(rootInjector: EnvironmentInjector);
93
+ /** Called when a `RouterOutlet` directive is instantiated */
94
+ onChildOutletCreated(childName: string, outlet: RouterOutletContract): void;
3644
95
  /**
3645
- * Aria-current attribute to apply when the router link is active.
3646
- *
3647
- * Possible values: `'page'` | `'step'` | `'location'` | `'date'` | `'time'` | `true` | `false`.
3648
- *
3649
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current}
96
+ * Called when a `RouterOutlet` directive is destroyed.
97
+ * We need to keep the context as the outlet could be destroyed inside a NgIf and might be
98
+ * re-created later.
3650
99
  */
3651
- ariaCurrentWhenActive?: 'page' | 'step' | 'location' | 'date' | 'time' | true | false;
100
+ onChildOutletDestroyed(childName: string): void;
3652
101
  /**
3653
- *
3654
- * You can use the output `isActiveChange` to get notified each time the link becomes
3655
- * active or inactive.
3656
- *
3657
- * Emits:
3658
- * true -> Route is active
3659
- * false -> Route is inactive
3660
- *
3661
- * ```html
3662
- * <a
3663
- * routerLink="/user/bob"
3664
- * routerLinkActive="active-link"
3665
- * (isActiveChange)="this.onRouterLinkActive($event)">Bob</a>
3666
- * ```
102
+ * Called when the corresponding route is deactivated during navigation.
103
+ * Because the component get destroyed, all children outlet are destroyed.
3667
104
  */
3668
- readonly isActiveChange: EventEmitter<boolean>;
3669
- constructor(router: Router, element: ElementRef, renderer: Renderer2, cdr: ChangeDetectorRef, link?: RouterLink | undefined);
3670
- /** @nodoc */
3671
- ngAfterContentInit(): void;
3672
- private subscribeToEachLinkOnChanges;
3673
- set routerLinkActive(data: string[] | string);
3674
- /** @nodoc */
3675
- ngOnChanges(changes: SimpleChanges): void;
3676
- /** @nodoc */
3677
- ngOnDestroy(): void;
3678
- private update;
3679
- private isLinkActive;
3680
- private hasActiveLinks;
3681
- static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkActive, [null, null, null, null, { optional: true; }]>;
3682
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkActive, "[routerLinkActive]", ["routerLinkActive"], { "routerLinkActiveOptions": { "alias": "routerLinkActiveOptions"; "required": false; }; "ariaCurrentWhenActive": { "alias": "ariaCurrentWhenActive"; "required": false; }; "routerLinkActive": { "alias": "routerLinkActive"; "required": false; }; }, { "isActiveChange": "isActiveChange"; }, ["links"], never, true, never>;
105
+ onOutletDeactivated(): Map<string, OutletContext>;
106
+ onOutletReAttached(contexts: Map<string, OutletContext>): void;
107
+ getOrCreateContext(childName: string): OutletContext;
108
+ getContext(childName: string): OutletContext | null;
109
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChildrenOutletContexts, never>;
110
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChildrenOutletContexts>;
3683
111
  }
3684
112
 
3685
113
  /**
@@ -3731,6 +159,11 @@ interface ViewTransitionInfo {
3731
159
  * @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/skipTransition
3732
160
  */
3733
161
  skipTransition(): void;
162
+ /**
163
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition#browser_compatibility
164
+ * @see https://developer.chrome.com/docs/web-platform/view-transitions/same-document#default_style_and_transition_reference
165
+ */
166
+ readonly types: Set<string>;
3734
167
  };
3735
168
  /**
3736
169
  * The `ActivatedRouteSnapshot` that the navigation is transitioning from.
@@ -3796,239 +229,6 @@ declare class DefaultTitleStrategy extends TitleStrategy {
3796
229
  static ɵprov: i0.ɵɵInjectableDeclaration<DefaultTitleStrategy>;
3797
230
  }
3798
231
 
3799
- /**
3800
- * Allowed values in an `ExtraOptions` object that configure
3801
- * when the router performs the initial navigation operation.
3802
- *
3803
- * * 'enabledNonBlocking' - (default) The initial navigation starts after the
3804
- * root component has been created. The bootstrap is not blocked on the completion of the initial
3805
- * navigation.
3806
- * * 'enabledBlocking' - The initial navigation starts before the root component is created.
3807
- * The bootstrap is blocked until the initial navigation is complete. This value should be set in
3808
- * case you use [server-side rendering](guide/ssr), but do not enable [hydration](guide/hydration)
3809
- * for your application.
3810
- * * 'disabled' - The initial navigation is not performed. The location listener is set up before
3811
- * the root component gets created. Use if there is a reason to have
3812
- * more control over when the router starts its initial navigation due to some complex
3813
- * initialization logic.
3814
- *
3815
- * @see {@link /api/router/RouterModule#forRoot forRoot}
3816
- *
3817
- * @publicApi
3818
- */
3819
- type InitialNavigation = 'disabled' | 'enabledBlocking' | 'enabledNonBlocking';
3820
- /**
3821
- * Extra configuration options that can be used with the `withRouterConfig` function.
3822
- *
3823
- * @publicApi
3824
- */
3825
- interface RouterConfigOptions {
3826
- /**
3827
- * Configures how the Router attempts to restore state when a navigation is cancelled.
3828
- *
3829
- * 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
3830
- * router before the navigation started. This means that if the URL of the browser is updated
3831
- * _before_ the navigation is canceled, the Router will simply replace the item in history rather
3832
- * than trying to restore to the previous location in the session history. This happens most
3833
- * frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
3834
- * buttons.
3835
- *
3836
- * 'computed' - Will attempt to return to the same index in the session history that corresponds
3837
- * to the Angular route when the navigation gets cancelled. For example, if the browser back
3838
- * button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
3839
- * and vice versa.
3840
- *
3841
- * Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
3842
- * handles a portion of the URL because the history restoration navigates to the previous place in
3843
- * the browser history rather than simply resetting a portion of the URL.
3844
- *
3845
- * The default value is `replace` when not set.
3846
- */
3847
- canceledNavigationResolution?: 'replace' | 'computed';
3848
- /**
3849
- * Configures the default for handling a navigation request to the current URL.
3850
- *
3851
- * If unset, the `Router` will use `'ignore'`.
3852
- *
3853
- * @see {@link OnSameUrlNavigation}
3854
- */
3855
- onSameUrlNavigation?: OnSameUrlNavigation;
3856
- /**
3857
- * Defines how the router merges parameters, data, and resolved data from parent to child
3858
- * routes.
3859
- *
3860
- * By default ('emptyOnly'), a route inherits the parent route's parameters when the route itself
3861
- * has an empty path (meaning its configured with path: '') or when the parent route doesn't have
3862
- * any component set.
3863
- *
3864
- * Set to 'always' to enable unconditional inheritance of parent parameters.
3865
- *
3866
- * Note that when dealing with matrix parameters, "parent" refers to the parent `Route`
3867
- * config which does not necessarily mean the "URL segment to the left". When the `Route` `path`
3868
- * contains multiple segments, the matrix parameters must appear on the last segment. For example,
3869
- * matrix parameters for `{path: 'a/b', component: MyComp}` should appear as `a/b;foo=bar` and not
3870
- * `a;foo=bar/b`.
3871
- *
3872
- */
3873
- paramsInheritanceStrategy?: 'emptyOnly' | 'always';
3874
- /**
3875
- * Defines when the router updates the browser URL. By default ('deferred'),
3876
- * update after successful navigation.
3877
- * Set to 'eager' if prefer to update the URL at the beginning of navigation.
3878
- * Updating the URL early allows you to handle a failure of navigation by
3879
- * showing an error message with the URL that failed.
3880
- */
3881
- urlUpdateStrategy?: 'deferred' | 'eager';
3882
- /**
3883
- * The default strategy to use for handling query params in `Router.createUrlTree` when one is not provided.
3884
- *
3885
- * The `createUrlTree` method is used internally by `Router.navigate` and `RouterLink`.
3886
- * Note that `QueryParamsHandling` does not apply to `Router.navigateByUrl`.
3887
- *
3888
- * When neither the default nor the queryParamsHandling option is specified in the call to `createUrlTree`,
3889
- * the current parameters will be replaced by new parameters.
3890
- *
3891
- * @see {@link Router#createUrlTree}
3892
- * @see {@link QueryParamsHandling}
3893
- */
3894
- defaultQueryParamsHandling?: QueryParamsHandling;
3895
- /**
3896
- * When `true`, the `Promise` will instead resolve with `false`, as it does with other failed
3897
- * navigations (for example, when guards are rejected).
3898
-
3899
- * Otherwise the `Promise` returned by the Router's navigation with be rejected
3900
- * if an error occurs.
3901
- */
3902
- resolveNavigationPromiseOnError?: boolean;
3903
- }
3904
- /**
3905
- * Configuration options for the scrolling feature which can be used with `withInMemoryScrolling`
3906
- * function.
3907
- *
3908
- * @publicApi
3909
- */
3910
- interface InMemoryScrollingOptions {
3911
- /**
3912
- * When set to 'enabled', scrolls to the anchor element when the URL has a fragment.
3913
- * Anchor scrolling is disabled by default.
3914
- *
3915
- * Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
3916
- * that we stored or scroll to the top.
3917
- */
3918
- anchorScrolling?: 'disabled' | 'enabled';
3919
- /**
3920
- * Configures if the scroll position needs to be restored when navigating back.
3921
- *
3922
- * * 'disabled'- (Default) Does nothing. Scroll position is maintained on navigation.
3923
- * * 'top'- Sets the scroll position to x = 0, y = 0 on all navigation.
3924
- * * 'enabled'- Restores the previous scroll position on backward navigation, else sets the
3925
- * position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
3926
- * navigation). This option will be the default in the future.
3927
- *
3928
- * You can implement custom scroll restoration behavior by adapting the enabled behavior as
3929
- * in the following example.
3930
- *
3931
- * ```ts
3932
- * class AppComponent {
3933
- * movieData: any;
3934
- *
3935
- * constructor(private router: Router, private viewportScroller: ViewportScroller,
3936
- * changeDetectorRef: ChangeDetectorRef) {
3937
- * router.events.pipe(filter((event: Event): event is Scroll => event instanceof Scroll)
3938
- * ).subscribe(e => {
3939
- * fetch('http://example.com/movies.json').then(response => {
3940
- * this.movieData = response.json();
3941
- * // update the template with the data before restoring scroll
3942
- * changeDetectorRef.detectChanges();
3943
- *
3944
- * if (e.position) {
3945
- * viewportScroller.scrollToPosition(e.position);
3946
- * }
3947
- * });
3948
- * });
3949
- * }
3950
- * }
3951
- * ```
3952
- */
3953
- scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
3954
- }
3955
- /**
3956
- * A set of configuration options for a router module, provided in the
3957
- * `forRoot()` method.
3958
- *
3959
- * @see {@link /api/router/routerModule#forRoot forRoot}
3960
- *
3961
- *
3962
- * @publicApi
3963
- */
3964
- interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
3965
- /**
3966
- * When true, log all internal navigation events to the console.
3967
- * Use for debugging.
3968
- */
3969
- enableTracing?: boolean;
3970
- /**
3971
- * When true, enable the location strategy that uses the URL fragment
3972
- * instead of the history API.
3973
- */
3974
- useHash?: boolean;
3975
- /**
3976
- * One of `enabled`, `enabledBlocking`, `enabledNonBlocking` or `disabled`.
3977
- * When set to `enabled` or `enabledBlocking`, the initial navigation starts before the root
3978
- * component is created. The bootstrap is blocked until the initial navigation is complete. This
3979
- * value should be set in case you use [server-side rendering](guide/ssr), but do not enable
3980
- * [hydration](guide/hydration) for your application. When set to `enabledNonBlocking`,
3981
- * the initial navigation starts after the root component has been created.
3982
- * The bootstrap is not blocked on the completion of the initial navigation. When set to
3983
- * `disabled`, the initial navigation is not performed. The location listener is set up before the
3984
- * root component gets created. Use if there is a reason to have more control over when the router
3985
- * starts its initial navigation due to some complex initialization logic.
3986
- */
3987
- initialNavigation?: InitialNavigation;
3988
- /**
3989
- * When true, enables binding information from the `Router` state directly to the inputs of the
3990
- * component in `Route` configurations.
3991
- */
3992
- bindToComponentInputs?: boolean;
3993
- /**
3994
- * When true, enables view transitions in the Router by running the route activation and
3995
- * deactivation inside of `document.startViewTransition`.
3996
- *
3997
- * @see https://developer.chrome.com/docs/web-platform/view-transitions/
3998
- * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
3999
- * @experimental
4000
- */
4001
- enableViewTransitions?: boolean;
4002
- /**
4003
- * A custom error handler for failed navigations.
4004
- * If the handler returns a value, the navigation Promise is resolved with this value.
4005
- * If the handler throws an exception, the navigation Promise is rejected with the exception.
4006
- *
4007
- * @see RouterConfigOptions
4008
- */
4009
- errorHandler?: (error: any) => RedirectCommand | any;
4010
- /**
4011
- * Configures a preloading strategy.
4012
- * One of `PreloadAllModules` or `NoPreloading` (the default).
4013
- */
4014
- preloadingStrategy?: any;
4015
- /**
4016
- * Configures the scroll offset the router will use when scrolling to an element.
4017
- *
4018
- * When given a tuple with x and y position value,
4019
- * the router uses that offset each time it scrolls.
4020
- * When given a function, the router invokes the function every time
4021
- * it restores scroll position.
4022
- */
4023
- scrollOffset?: [number, number] | (() => [number, number]);
4024
- }
4025
- /**
4026
- * A DI token for the router service.
4027
- *
4028
- * @publicApi
4029
- */
4030
- declare const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>;
4031
-
4032
232
  /**
4033
233
  * The DI token for a router configuration.
4034
234
  *
@@ -4174,7 +374,7 @@ declare function provideRouter(routes: Routes, ...features: RouterFeatures[]): E
4174
374
  */
4175
375
  interface RouterFeature<FeatureKind extends RouterFeatureKind> {
4176
376
  ɵkind: FeatureKind;
4177
- ɵproviders: Provider[];
377
+ ɵproviders: Array<Provider | EnvironmentProviders>;
4178
378
  }
4179
379
  /**
4180
380
  * Registers a DI provider for a set of routes.
@@ -4613,92 +813,6 @@ declare const enum RouterFeatureKind {
4613
813
  ViewTransitionsFeature = 9
4614
814
  }
4615
815
 
4616
- /**
4617
- * This component is used internally within the router to be a placeholder when an empty
4618
- * router-outlet is needed. For example, with a config such as:
4619
- *
4620
- * `{path: 'parent', outlet: 'nav', children: [...]}`
4621
- *
4622
- * In order to render, there needs to be a component on this config, which will default
4623
- * to this `EmptyOutletComponent`.
4624
- */
4625
- declare class ɵEmptyOutletComponent {
4626
- static ɵfac: i0.ɵɵFactoryDeclaration<ɵEmptyOutletComponent, never>;
4627
- static ɵcmp: i0.ɵɵComponentDeclaration<ɵEmptyOutletComponent, "ng-component", ["emptyRouterOutlet"], {}, {}, never, never, true, never>;
4628
- }
4629
-
4630
- declare const ROUTER_PROVIDERS: Provider[];
4631
- /**
4632
- * @description
4633
- *
4634
- * Adds directives and providers for in-app navigation among views defined in an application.
4635
- * Use the Angular `Router` service to declaratively specify application states and manage state
4636
- * transitions.
4637
- *
4638
- * You can import this NgModule multiple times, once for each lazy-loaded bundle.
4639
- * However, only one `Router` service can be active.
4640
- * To ensure this, there are two ways to register routes when importing this module:
4641
- *
4642
- * * The `forRoot()` method creates an `NgModule` that contains all the directives, the given
4643
- * routes, and the `Router` service itself.
4644
- * * The `forChild()` method creates an `NgModule` that contains all the directives and the given
4645
- * routes, but does not include the `Router` service.
4646
- *
4647
- * @see [Routing and Navigation guide](guide/routing/common-router-tasks) for an
4648
- * overview of how the `Router` service should be used.
4649
- *
4650
- * @publicApi
4651
- */
4652
- declare class RouterModule {
4653
- constructor();
4654
- /**
4655
- * Creates and configures a module with all the router providers and directives.
4656
- * Optionally sets up an application listener to perform an initial navigation.
4657
- *
4658
- * When registering the NgModule at the root, import as follows:
4659
- *
4660
- * ```ts
4661
- * @NgModule({
4662
- * imports: [RouterModule.forRoot(ROUTES)]
4663
- * })
4664
- * class MyNgModule {}
4665
- * ```
4666
- *
4667
- * @param routes An array of `Route` objects that define the navigation paths for the application.
4668
- * @param config An `ExtraOptions` configuration object that controls how navigation is performed.
4669
- * @return The new `NgModule`.
4670
- *
4671
- */
4672
- static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterModule>;
4673
- /**
4674
- * Creates a module with all the router directives and a provider registering routes,
4675
- * without creating a new Router service.
4676
- * When registering for submodules and lazy-loaded submodules, create the NgModule as follows:
4677
- *
4678
- * ```ts
4679
- * @NgModule({
4680
- * imports: [RouterModule.forChild(ROUTES)]
4681
- * })
4682
- * class MyNgModule {}
4683
- * ```
4684
- *
4685
- * @param routes An array of `Route` objects that define the navigation paths for the submodule.
4686
- * @return The new NgModule.
4687
- *
4688
- */
4689
- static forChild(routes: Routes): ModuleWithProviders<RouterModule>;
4690
- static ɵfac: i0.ɵɵFactoryDeclaration<RouterModule, never>;
4691
- static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, never, [typeof RouterOutlet, typeof RouterLink, typeof RouterLinkActive, typeof ɵEmptyOutletComponent], [typeof RouterOutlet, typeof RouterLink, typeof RouterLinkActive, typeof ɵEmptyOutletComponent]>;
4692
- static ɵinj: i0.ɵɵInjectorDeclaration<RouterModule>;
4693
- }
4694
- /**
4695
- * A DI token for the router initializer that
4696
- * is called after the app is bootstrapped.
4697
- *
4698
- * @publicApi
4699
- */
4700
- declare const ROUTER_INITIALIZER: InjectionToken<(compRef: ComponentRef<any>) => void>;
4701
-
4702
816
  /**
4703
817
  * @description
4704
818
  *
@@ -4804,4 +918,5 @@ declare function afterNextNavigation(router: {
4804
918
  events: Observable<Event>;
4805
919
  }, action: () => void): void;
4806
920
 
4807
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, type CanActivate, type CanActivateChild, type CanActivateChildFn, type CanActivateFn, type CanDeactivate, type CanDeactivateFn, type CanLoad, type CanLoadFn, type CanMatch, type CanMatchFn, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, type ComponentInputBindingFeature, type Data, type DebugTracingFeature, type DefaultExport, DefaultTitleStrategy, DefaultUrlSerializer, type DeprecatedGuard, type DetachedRouteHandle, type DisabledInitialNavigationFeature, type EnabledBlockingInitialNavigationFeature, type Event, EventType, type ExtraOptions, type GuardResult, GuardsCheckEnd, GuardsCheckStart, type InMemoryScrollingFeature, type InMemoryScrollingOptions, type InitialNavigation, type InitialNavigationFeature, type IsActiveMatchOptions, type LoadChildren, type LoadChildrenCallback, type MaybeAsync, type Navigation, type NavigationBehaviorOptions, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, type NavigationErrorHandlerFeature, type NavigationExtras, NavigationSkipped, NavigationSkippedCode, NavigationStart, NoPreloading, type OnSameUrlNavigation, OutletContext, PRIMARY_OUTLET, type ParamMap, type Params, PreloadAllModules, type PreloadingFeature, PreloadingStrategy, type QueryParamsHandling, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, type RedirectFunction, type Resolve, type ResolveData, ResolveEnd, type ResolveFn, ResolveStart, type Route, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, type RouterConfigOptions, type RouterConfigurationFeature, RouterEvent, type RouterFeature, type RouterFeatures, type RouterHashLocationFeature, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, type RouterOutletContract, RouterPreloader, RouterState, RouterStateSnapshot, type Routes, RoutesRecognized, type RunGuardsAndResolvers, Scroll, TitleStrategy, type UrlCreationOptions, UrlHandlingStrategy, type UrlMatchResult, type UrlMatcher, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, type ViewTransitionInfo, type ViewTransitionsFeature, type ViewTransitionsFeatureOptions, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, type RestoredState as ɵRestoredState, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };
921
+ export { ActivatedRoute, ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanActivateChildFn, CanActivateFn, CanDeactivate, CanDeactivateFn, CanMatch, CanMatchFn, ChildrenOutletContexts, DefaultTitleStrategy, Event, InMemoryScrollingOptions, NavigationError, NoPreloading, OutletContext, Params, PreloadAllModules, PreloadingStrategy, ROUTES, RedirectCommand, Resolve, ResolveFn, Route, Router, RouterConfigOptions, RouterOutletContract, RouterPreloader, RouterStateSnapshot, Routes, TitleStrategy, UrlHandlingStrategy, UrlTree, VERSION, createUrlTreeFromSnapshot, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };
922
+ export type { ComponentInputBindingFeature, DebugTracingFeature, DisabledInitialNavigationFeature, EnabledBlockingInitialNavigationFeature, InMemoryScrollingFeature, InitialNavigationFeature, NavigationErrorHandlerFeature, PreloadingFeature, RouterConfigurationFeature, RouterFeature, RouterFeatures, RouterHashLocationFeature, ViewTransitionInfo, ViewTransitionsFeature, ViewTransitionsFeatureOptions };