UNPKG

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