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