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