UNPKG

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