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