UNPKG

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