source: trip-planner-front/node_modules/@angular/router/router.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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