UNPKG

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