@angular/router 14.2.0-next.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/apply_redirects.mjs +4 -3
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/directives/router_link.mjs +101 -23
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/index.mjs +3 -2
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/operators/check_guards.mjs +36 -26
- package/esm2020/src/operators/resolve_data.mjs +19 -15
- package/esm2020/src/page_title_strategy.mjs +6 -6
- package/esm2020/src/patchable_relative_link_resolution.mjs +12 -0
- package/esm2020/src/private_export.mjs +3 -2
- package/esm2020/src/provide_router.mjs +420 -0
- package/esm2020/src/recognize.mjs +4 -3
- package/esm2020/src/router.mjs +6 -4
- package/esm2020/src/router_config.mjs +1 -1
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +28 -185
- package/esm2020/src/router_outlet_context.mjs +3 -3
- package/esm2020/src/router_preloader.mjs +12 -11
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/url_tree.mjs +3 -3
- package/esm2020/src/utils/preactivation.mjs +16 -6
- package/esm2020/src/utils/type_guards.mjs +5 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/provide_router_for_testing.mjs +51 -0
- package/esm2020/testing/src/router_testing_module.mjs +8 -8
- package/fesm2015/router.mjs +697 -322
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +8 -8
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +691 -320
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +8 -8
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +589 -211
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.2.0
|
|
2
|
+
* @license Angular v14.2.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -262,7 +262,7 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
|
|
|
262
262
|
* ```
|
|
263
263
|
* class UserToken {}
|
|
264
264
|
* class Permissions {
|
|
265
|
-
* canActivate(
|
|
265
|
+
* canActivate(): boolean {
|
|
266
266
|
* return true;
|
|
267
267
|
* }
|
|
268
268
|
* }
|
|
@@ -299,7 +299,7 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
|
|
|
299
299
|
* class AppModule {}
|
|
300
300
|
* ```
|
|
301
301
|
*
|
|
302
|
-
* You can alternatively provide an in-line function with the `
|
|
302
|
+
* You can alternatively provide an in-line function with the `CanActivateFn` signature:
|
|
303
303
|
*
|
|
304
304
|
* ```
|
|
305
305
|
* @NgModule({
|
|
@@ -308,16 +308,10 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
|
|
|
308
308
|
* {
|
|
309
309
|
* path: 'team/:id',
|
|
310
310
|
* component: TeamComponent,
|
|
311
|
-
* canActivate: [
|
|
311
|
+
* canActivate: [(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true]
|
|
312
312
|
* }
|
|
313
313
|
* ])
|
|
314
314
|
* ],
|
|
315
|
-
* providers: [
|
|
316
|
-
* {
|
|
317
|
-
* provide: 'canActivateTeam',
|
|
318
|
-
* useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true
|
|
319
|
-
* }
|
|
320
|
-
* ]
|
|
321
315
|
* })
|
|
322
316
|
* class AppModule {}
|
|
323
317
|
* ```
|
|
@@ -384,7 +378,7 @@ export declare interface CanActivate {
|
|
|
384
378
|
* class AppModule {}
|
|
385
379
|
* ```
|
|
386
380
|
*
|
|
387
|
-
* You can alternatively provide an in-line function with the `
|
|
381
|
+
* You can alternatively provide an in-line function with the `CanActivateChildFn` signature:
|
|
388
382
|
*
|
|
389
383
|
* ```
|
|
390
384
|
* @NgModule({
|
|
@@ -392,7 +386,7 @@ export declare interface CanActivate {
|
|
|
392
386
|
* RouterModule.forRoot([
|
|
393
387
|
* {
|
|
394
388
|
* path: 'root',
|
|
395
|
-
* canActivateChild: [
|
|
389
|
+
* canActivateChild: [(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true],
|
|
396
390
|
* children: [
|
|
397
391
|
* {
|
|
398
392
|
* path: 'team/:id',
|
|
@@ -402,12 +396,6 @@ export declare interface CanActivate {
|
|
|
402
396
|
* }
|
|
403
397
|
* ])
|
|
404
398
|
* ],
|
|
405
|
-
* providers: [
|
|
406
|
-
* {
|
|
407
|
-
* provide: 'canActivateTeam',
|
|
408
|
-
* useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true
|
|
409
|
-
* }
|
|
410
|
-
* ]
|
|
411
399
|
* })
|
|
412
400
|
* class AppModule {}
|
|
413
401
|
* ```
|
|
@@ -418,6 +406,24 @@ export declare interface CanActivateChild {
|
|
|
418
406
|
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
419
407
|
}
|
|
420
408
|
|
|
409
|
+
/**
|
|
410
|
+
* The signature of a function used as a `canActivateChild` guard on a `Route`.
|
|
411
|
+
*
|
|
412
|
+
* @publicApi
|
|
413
|
+
* @see `CanActivateChild`
|
|
414
|
+
* @see `Route`
|
|
415
|
+
*/
|
|
416
|
+
export declare type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* The signature of a function used as a `canActivate` guard on a `Route`.
|
|
420
|
+
*
|
|
421
|
+
* @publicApi
|
|
422
|
+
* @see `CanActivate`
|
|
423
|
+
* @see `Route`
|
|
424
|
+
*/
|
|
425
|
+
export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
426
|
+
|
|
421
427
|
/**
|
|
422
428
|
* @description
|
|
423
429
|
*
|
|
@@ -472,7 +478,7 @@ export declare interface CanActivateChild {
|
|
|
472
478
|
* class AppModule {}
|
|
473
479
|
* ```
|
|
474
480
|
*
|
|
475
|
-
* You can alternatively provide an in-line function with the `
|
|
481
|
+
* You can alternatively provide an in-line function with the `CanDeactivateFn` signature:
|
|
476
482
|
*
|
|
477
483
|
* ```
|
|
478
484
|
* @NgModule({
|
|
@@ -481,17 +487,11 @@ export declare interface CanActivateChild {
|
|
|
481
487
|
* {
|
|
482
488
|
* path: 'team/:id',
|
|
483
489
|
* component: TeamComponent,
|
|
484
|
-
* canDeactivate: [
|
|
490
|
+
* canDeactivate: [(component: TeamComponent, currentRoute: ActivatedRouteSnapshot,
|
|
491
|
+
* currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => true]
|
|
485
492
|
* }
|
|
486
493
|
* ])
|
|
487
494
|
* ],
|
|
488
|
-
* providers: [
|
|
489
|
-
* {
|
|
490
|
-
* provide: 'canDeactivateTeam',
|
|
491
|
-
* useValue: (component: TeamComponent, currentRoute: ActivatedRouteSnapshot, currentState:
|
|
492
|
-
* RouterStateSnapshot, nextState: RouterStateSnapshot) => true
|
|
493
|
-
* }
|
|
494
|
-
* ]
|
|
495
495
|
* })
|
|
496
496
|
* class AppModule {}
|
|
497
497
|
* ```
|
|
@@ -502,6 +502,15 @@ export declare interface CanDeactivate<T> {
|
|
|
502
502
|
canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
/**
|
|
506
|
+
* The signature of a function used as a `canDeactivate` guard on a `Route`.
|
|
507
|
+
*
|
|
508
|
+
* @publicApi
|
|
509
|
+
* @see `CanDeactivate`
|
|
510
|
+
* @see `Route`
|
|
511
|
+
*/
|
|
512
|
+
export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
513
|
+
|
|
505
514
|
/**
|
|
506
515
|
* @description
|
|
507
516
|
*
|
|
@@ -553,7 +562,7 @@ export declare interface CanDeactivate<T> {
|
|
|
553
562
|
* class AppModule {}
|
|
554
563
|
* ```
|
|
555
564
|
*
|
|
556
|
-
* You can alternatively provide an in-line function with the `
|
|
565
|
+
* You can alternatively provide an in-line function with the `CanLoadFn` signature:
|
|
557
566
|
*
|
|
558
567
|
* ```
|
|
559
568
|
* @NgModule({
|
|
@@ -563,16 +572,10 @@ export declare interface CanDeactivate<T> {
|
|
|
563
572
|
* path: 'team/:id',
|
|
564
573
|
* component: TeamComponent,
|
|
565
574
|
* loadChildren: () => import('./team').then(mod => mod.TeamModule),
|
|
566
|
-
* canLoad: [
|
|
575
|
+
* canLoad: [(route: Route, segments: UrlSegment[]) => true]
|
|
567
576
|
* }
|
|
568
577
|
* ])
|
|
569
578
|
* ],
|
|
570
|
-
* providers: [
|
|
571
|
-
* {
|
|
572
|
-
* provide: 'canLoadTeamSection',
|
|
573
|
-
* useValue: (route: Route, segments: UrlSegment[]) => true
|
|
574
|
-
* }
|
|
575
|
-
* ]
|
|
576
579
|
* })
|
|
577
580
|
* class AppModule {}
|
|
578
581
|
* ```
|
|
@@ -583,6 +586,15 @@ export declare interface CanLoad {
|
|
|
583
586
|
canLoad(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
584
587
|
}
|
|
585
588
|
|
|
589
|
+
/**
|
|
590
|
+
* The signature of a function used as a `canLoad` guard on a `Route`.
|
|
591
|
+
*
|
|
592
|
+
* @publicApi
|
|
593
|
+
* @see `CanLoad`
|
|
594
|
+
* @see `Route`
|
|
595
|
+
*/
|
|
596
|
+
export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
597
|
+
|
|
586
598
|
/**
|
|
587
599
|
* @description
|
|
588
600
|
*
|
|
@@ -642,11 +654,9 @@ export declare interface CanLoad {
|
|
|
642
654
|
* `team/:id` URL, but would load the `NotFoundComponent` because the `Route` for `'team/:id'`
|
|
643
655
|
* could not be used for a URL match but the catch-all `**` `Route` did instead.
|
|
644
656
|
*
|
|
645
|
-
* You can alternatively provide an in-line function with the `
|
|
657
|
+
* You can alternatively provide an in-line function with the `CanMatchFn` signature:
|
|
646
658
|
*
|
|
647
659
|
* ```
|
|
648
|
-
* const CAN_MATCH_TEAM_SECTION = new InjectionToken('CanMatchTeamSection');
|
|
649
|
-
*
|
|
650
660
|
* @NgModule({
|
|
651
661
|
* imports: [
|
|
652
662
|
* RouterModule.forRoot([
|
|
@@ -654,7 +664,7 @@ export declare interface CanLoad {
|
|
|
654
664
|
* path: 'team/:id',
|
|
655
665
|
* component: TeamComponent,
|
|
656
666
|
* loadChildren: () => import('./team').then(mod => mod.TeamModule),
|
|
657
|
-
* canMatch: [
|
|
667
|
+
* canMatch: [(route: Route, segments: UrlSegment[]) => true]
|
|
658
668
|
* },
|
|
659
669
|
* {
|
|
660
670
|
* path: '**',
|
|
@@ -662,12 +672,6 @@ export declare interface CanLoad {
|
|
|
662
672
|
* }
|
|
663
673
|
* ])
|
|
664
674
|
* ],
|
|
665
|
-
* providers: [
|
|
666
|
-
* {
|
|
667
|
-
* provide: CAN_MATCH_TEAM_SECTION,
|
|
668
|
-
* useValue: (route: Route, segments: UrlSegment[]) => true
|
|
669
|
-
* }
|
|
670
|
-
* ]
|
|
671
675
|
* })
|
|
672
676
|
* class AppModule {}
|
|
673
677
|
* ```
|
|
@@ -823,6 +827,17 @@ export declare type Data = {
|
|
|
823
827
|
[key: string | symbol]: any;
|
|
824
828
|
};
|
|
825
829
|
|
|
830
|
+
/**
|
|
831
|
+
* A type alias for providers returned by `withDebugTracing` for use with `provideRouter`.
|
|
832
|
+
*
|
|
833
|
+
* @see `withDebugTracing`
|
|
834
|
+
* @see `provideRouter`
|
|
835
|
+
*
|
|
836
|
+
* @publicApi
|
|
837
|
+
* @developerPreview
|
|
838
|
+
*/
|
|
839
|
+
export declare type DebugTracingFeature = RouterFeature<RouterFeatureKind.DebugTracingFeature>;
|
|
840
|
+
|
|
826
841
|
/**
|
|
827
842
|
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
828
843
|
*/
|
|
@@ -893,6 +908,30 @@ export declare class DefaultUrlSerializer implements UrlSerializer {
|
|
|
893
908
|
*/
|
|
894
909
|
export declare type DetachedRouteHandle = {};
|
|
895
910
|
|
|
911
|
+
/**
|
|
912
|
+
* A type alias for providers returned by `withDisabledInitialNavigation` for use with
|
|
913
|
+
* `provideRouter`.
|
|
914
|
+
*
|
|
915
|
+
* @see `withDisabledInitialNavigation`
|
|
916
|
+
* @see `provideRouter`
|
|
917
|
+
*
|
|
918
|
+
* @publicApi
|
|
919
|
+
* @developerPreview
|
|
920
|
+
*/
|
|
921
|
+
export declare type DisabledInitialNavigationFeature = RouterFeature<RouterFeatureKind.DisabledInitialNavigationFeature>;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* A type alias for providers returned by `withEnabledBlockingInitialNavigation` for use with
|
|
925
|
+
* `provideRouter`.
|
|
926
|
+
*
|
|
927
|
+
* @see `withEnabledBlockingInitialNavigation`
|
|
928
|
+
* @see `provideRouter`
|
|
929
|
+
*
|
|
930
|
+
* @publicApi
|
|
931
|
+
* @developerPreview
|
|
932
|
+
*/
|
|
933
|
+
export declare type EnabledBlockingInitialNavigationFeature = RouterFeature<RouterFeatureKind.EnabledBlockingInitialNavigationFeature>;
|
|
934
|
+
|
|
896
935
|
/**
|
|
897
936
|
* Error handler that is invoked when a navigation error occurs.
|
|
898
937
|
*
|
|
@@ -973,7 +1012,7 @@ export declare const enum EventType {
|
|
|
973
1012
|
*
|
|
974
1013
|
* @publicApi
|
|
975
1014
|
*/
|
|
976
|
-
export declare interface ExtraOptions {
|
|
1015
|
+
export declare interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
|
|
977
1016
|
/**
|
|
978
1017
|
* When true, log all internal navigation events to the console.
|
|
979
1018
|
* Use for debugging.
|
|
@@ -1008,57 +1047,6 @@ export declare interface ExtraOptions {
|
|
|
1008
1047
|
* One of `PreloadAllModules` or `NoPreloading` (the default).
|
|
1009
1048
|
*/
|
|
1010
1049
|
preloadingStrategy?: any;
|
|
1011
|
-
/**
|
|
1012
|
-
* Define what the router should do if it receives a navigation request to the current URL.
|
|
1013
|
-
* Default is `ignore`, which causes the router ignores the navigation.
|
|
1014
|
-
* This can disable features such as a "refresh" button.
|
|
1015
|
-
* Use this option to configure the behavior when navigating to the
|
|
1016
|
-
* current URL. Default is 'ignore'.
|
|
1017
|
-
*/
|
|
1018
|
-
onSameUrlNavigation?: 'reload' | 'ignore';
|
|
1019
|
-
/**
|
|
1020
|
-
* Configures if the scroll position needs to be restored when navigating back.
|
|
1021
|
-
*
|
|
1022
|
-
* * 'disabled'- (Default) Does nothing. Scroll position is maintained on navigation.
|
|
1023
|
-
* * 'top'- Sets the scroll position to x = 0, y = 0 on all navigation.
|
|
1024
|
-
* * 'enabled'- Restores the previous scroll position on backward navigation, else sets the
|
|
1025
|
-
* position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
|
|
1026
|
-
* navigation). This option will be the default in the future.
|
|
1027
|
-
*
|
|
1028
|
-
* You can implement custom scroll restoration behavior by adapting the enabled behavior as
|
|
1029
|
-
* in the following example.
|
|
1030
|
-
*
|
|
1031
|
-
* ```typescript
|
|
1032
|
-
* class AppComponent {
|
|
1033
|
-
* movieData: any;
|
|
1034
|
-
*
|
|
1035
|
-
* constructor(private router: Router, private viewportScroller: ViewportScroller,
|
|
1036
|
-
* changeDetectorRef: ChangeDetectorRef) {
|
|
1037
|
-
* router.events.pipe(filter((event: Event): event is Scroll => event instanceof Scroll)
|
|
1038
|
-
* ).subscribe(e => {
|
|
1039
|
-
* fetch('http://example.com/movies.json').then(response => {
|
|
1040
|
-
* this.movieData = response.json();
|
|
1041
|
-
* // update the template with the data before restoring scroll
|
|
1042
|
-
* changeDetectorRef.detectChanges();
|
|
1043
|
-
*
|
|
1044
|
-
* if (e.position) {
|
|
1045
|
-
* viewportScroller.scrollToPosition(e.position);
|
|
1046
|
-
* }
|
|
1047
|
-
* });
|
|
1048
|
-
* });
|
|
1049
|
-
* }
|
|
1050
|
-
* }
|
|
1051
|
-
* ```
|
|
1052
|
-
*/
|
|
1053
|
-
scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
|
|
1054
|
-
/**
|
|
1055
|
-
* When set to 'enabled', scrolls to the anchor element when the URL has a fragment.
|
|
1056
|
-
* Anchor scrolling is disabled by default.
|
|
1057
|
-
*
|
|
1058
|
-
* Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
|
|
1059
|
-
* that we stored or scroll to the top.
|
|
1060
|
-
*/
|
|
1061
|
-
anchorScrolling?: 'disabled' | 'enabled';
|
|
1062
1050
|
/**
|
|
1063
1051
|
* Configures the scroll offset the router will use when scrolling to an element.
|
|
1064
1052
|
*
|
|
@@ -1068,21 +1056,6 @@ export declare interface ExtraOptions {
|
|
|
1068
1056
|
* it restores scroll position.
|
|
1069
1057
|
*/
|
|
1070
1058
|
scrollOffset?: [number, number] | (() => [number, number]);
|
|
1071
|
-
/**
|
|
1072
|
-
* Defines how the router merges parameters, data, and resolved data from parent to child
|
|
1073
|
-
* routes. By default ('emptyOnly'), inherits parent parameters only for
|
|
1074
|
-
* path-less or component-less routes.
|
|
1075
|
-
*
|
|
1076
|
-
* Set to 'always' to enable unconditional inheritance of parent parameters.
|
|
1077
|
-
*
|
|
1078
|
-
* Note that when dealing with matrix parameters, "parent" refers to the parent `Route`
|
|
1079
|
-
* config which does not necessarily mean the "URL segment to the left". When the `Route` `path`
|
|
1080
|
-
* contains multiple segments, the matrix parameters must appear on the last segment. For example,
|
|
1081
|
-
* matrix parameters for `{path: 'a/b', component: MyComp}` should appear as `a/b;foo=bar` and not
|
|
1082
|
-
* `a;foo=bar/b`.
|
|
1083
|
-
*
|
|
1084
|
-
*/
|
|
1085
|
-
paramsInheritanceStrategy?: 'emptyOnly' | 'always';
|
|
1086
1059
|
/**
|
|
1087
1060
|
* A custom handler for malformed URI errors. The handler is invoked when `encodedURI` contains
|
|
1088
1061
|
* invalid character sequences.
|
|
@@ -1094,14 +1067,6 @@ export declare interface ExtraOptions {
|
|
|
1094
1067
|
* - `'url'` - The malformed URL that caused the URIError
|
|
1095
1068
|
* */
|
|
1096
1069
|
malformedUriErrorHandler?: (error: URIError, urlSerializer: UrlSerializer, url: string) => UrlTree;
|
|
1097
|
-
/**
|
|
1098
|
-
* Defines when the router updates the browser URL. By default ('deferred'),
|
|
1099
|
-
* update after successful navigation.
|
|
1100
|
-
* Set to 'eager' if prefer to update the URL at the beginning of navigation.
|
|
1101
|
-
* Updating the URL early allows you to handle a failure of navigation by
|
|
1102
|
-
* showing an error message with the URL that failed.
|
|
1103
|
-
*/
|
|
1104
|
-
urlUpdateStrategy?: 'deferred' | 'eager';
|
|
1105
1070
|
/**
|
|
1106
1071
|
* Enables a bug fix that corrects relative link resolution in components with empty paths.
|
|
1107
1072
|
* Example:
|
|
@@ -1137,28 +1102,6 @@ export declare interface ExtraOptions {
|
|
|
1137
1102
|
* @deprecated
|
|
1138
1103
|
*/
|
|
1139
1104
|
relativeLinkResolution?: 'legacy' | 'corrected';
|
|
1140
|
-
/**
|
|
1141
|
-
* Configures how the Router attempts to restore state when a navigation is cancelled.
|
|
1142
|
-
*
|
|
1143
|
-
* 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
|
|
1144
|
-
* router before the navigation started. This means that if the URL of the browser is updated
|
|
1145
|
-
* _before_ the navigation is canceled, the Router will simply replace the item in history rather
|
|
1146
|
-
* than trying to restore to the previous location in the session history. This happens most
|
|
1147
|
-
* frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
|
|
1148
|
-
* buttons.
|
|
1149
|
-
*
|
|
1150
|
-
* 'computed' - Will attempt to return to the same index in the session history that corresponds
|
|
1151
|
-
* to the Angular route when the navigation gets cancelled. For example, if the browser back
|
|
1152
|
-
* button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
|
|
1153
|
-
* and vice versa.
|
|
1154
|
-
*
|
|
1155
|
-
* Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
|
|
1156
|
-
* handles a portion of the URL because the history restoration navigates to the previous place in
|
|
1157
|
-
* the browser history rather than simply resetting a portion of the URL.
|
|
1158
|
-
*
|
|
1159
|
-
* The default value is `replace` when not set.
|
|
1160
|
-
*/
|
|
1161
|
-
canceledNavigationResolution?: 'replace' | 'computed';
|
|
1162
1105
|
}
|
|
1163
1106
|
|
|
1164
1107
|
/**
|
|
@@ -1263,6 +1206,83 @@ declare namespace i4 {
|
|
|
1263
1206
|
*/
|
|
1264
1207
|
export declare type InitialNavigation = 'disabled' | 'enabledBlocking' | 'enabledNonBlocking';
|
|
1265
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* A type alias for providers returned by `withEnabledBlockingInitialNavigation` or
|
|
1211
|
+
* `withDisabledInitialNavigation` functions for use with `provideRouter`.
|
|
1212
|
+
*
|
|
1213
|
+
* @see `withEnabledBlockingInitialNavigation`
|
|
1214
|
+
* @see `withDisabledInitialNavigation`
|
|
1215
|
+
* @see `provideRouter`
|
|
1216
|
+
*
|
|
1217
|
+
* @publicApi
|
|
1218
|
+
* @developerPreview
|
|
1219
|
+
*/
|
|
1220
|
+
export declare type InitialNavigationFeature = EnabledBlockingInitialNavigationFeature | DisabledInitialNavigationFeature;
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* A type alias for providers returned by `withInMemoryScrolling` for use with `provideRouter`.
|
|
1224
|
+
*
|
|
1225
|
+
* @see `withInMemoryScrolling`
|
|
1226
|
+
* @see `provideRouter`
|
|
1227
|
+
*
|
|
1228
|
+
* @publicApi
|
|
1229
|
+
* @developerPreview
|
|
1230
|
+
*/
|
|
1231
|
+
export declare type InMemoryScrollingFeature = RouterFeature<RouterFeatureKind.InMemoryScrollingFeature>;
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Configuration options for the scrolling feature which can be used with `withInMemoryScrolling`
|
|
1235
|
+
* function.
|
|
1236
|
+
*
|
|
1237
|
+
* @publicApi
|
|
1238
|
+
* @developerPreview
|
|
1239
|
+
*/
|
|
1240
|
+
export declare interface InMemoryScrollingOptions {
|
|
1241
|
+
/**
|
|
1242
|
+
* When set to 'enabled', scrolls to the anchor element when the URL has a fragment.
|
|
1243
|
+
* Anchor scrolling is disabled by default.
|
|
1244
|
+
*
|
|
1245
|
+
* Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
|
|
1246
|
+
* that we stored or scroll to the top.
|
|
1247
|
+
*/
|
|
1248
|
+
anchorScrolling?: 'disabled' | 'enabled';
|
|
1249
|
+
/**
|
|
1250
|
+
* Configures if the scroll position needs to be restored when navigating back.
|
|
1251
|
+
*
|
|
1252
|
+
* * 'disabled'- (Default) Does nothing. Scroll position is maintained on navigation.
|
|
1253
|
+
* * 'top'- Sets the scroll position to x = 0, y = 0 on all navigation.
|
|
1254
|
+
* * 'enabled'- Restores the previous scroll position on backward navigation, else sets the
|
|
1255
|
+
* position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
|
|
1256
|
+
* navigation). This option will be the default in the future.
|
|
1257
|
+
*
|
|
1258
|
+
* You can implement custom scroll restoration behavior by adapting the enabled behavior as
|
|
1259
|
+
* in the following example.
|
|
1260
|
+
*
|
|
1261
|
+
* ```typescript
|
|
1262
|
+
* class AppComponent {
|
|
1263
|
+
* movieData: any;
|
|
1264
|
+
*
|
|
1265
|
+
* constructor(private router: Router, private viewportScroller: ViewportScroller,
|
|
1266
|
+
* changeDetectorRef: ChangeDetectorRef) {
|
|
1267
|
+
* router.events.pipe(filter((event: Event): event is Scroll => event instanceof Scroll)
|
|
1268
|
+
* ).subscribe(e => {
|
|
1269
|
+
* fetch('http://example.com/movies.json').then(response => {
|
|
1270
|
+
* this.movieData = response.json();
|
|
1271
|
+
* // update the template with the data before restoring scroll
|
|
1272
|
+
* changeDetectorRef.detectChanges();
|
|
1273
|
+
*
|
|
1274
|
+
* if (e.position) {
|
|
1275
|
+
* viewportScroller.scrollToPosition(e.position);
|
|
1276
|
+
* }
|
|
1277
|
+
* });
|
|
1278
|
+
* });
|
|
1279
|
+
* }
|
|
1280
|
+
* }
|
|
1281
|
+
* ```
|
|
1282
|
+
*/
|
|
1283
|
+
scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1266
1286
|
/**
|
|
1267
1287
|
* A set of options which specify how to determine if a `UrlTree` is active, given the `UrlTree`
|
|
1268
1288
|
* for the current router state.
|
|
@@ -1783,6 +1803,18 @@ export declare class PreloadAllModules implements PreloadingStrategy {
|
|
|
1783
1803
|
static ɵprov: i0.ɵɵInjectableDeclaration<PreloadAllModules>;
|
|
1784
1804
|
}
|
|
1785
1805
|
|
|
1806
|
+
/**
|
|
1807
|
+
* A type alias that represents a feature which enables preloading in Router.
|
|
1808
|
+
* The type is used to describe the return value of the `withPreloading` function.
|
|
1809
|
+
*
|
|
1810
|
+
* @see `withPreloading`
|
|
1811
|
+
* @see `provideRouter`
|
|
1812
|
+
*
|
|
1813
|
+
* @publicApi
|
|
1814
|
+
* @developerPreview
|
|
1815
|
+
*/
|
|
1816
|
+
export declare type PreloadingFeature = RouterFeature<RouterFeatureKind.PreloadingFeature>;
|
|
1817
|
+
|
|
1786
1818
|
/**
|
|
1787
1819
|
* @description
|
|
1788
1820
|
*
|
|
@@ -1801,6 +1833,45 @@ export declare abstract class PreloadingStrategy {
|
|
|
1801
1833
|
*/
|
|
1802
1834
|
export declare const PRIMARY_OUTLET = "primary";
|
|
1803
1835
|
|
|
1836
|
+
/**
|
|
1837
|
+
* Sets up providers necessary to enable `Router` functionality for the application.
|
|
1838
|
+
* Allows to configure a set of routes as well as extra features that should be enabled.
|
|
1839
|
+
*
|
|
1840
|
+
* @usageNotes
|
|
1841
|
+
*
|
|
1842
|
+
* Basic example of how you can add a Router to your application:
|
|
1843
|
+
* ```
|
|
1844
|
+
* const appRoutes: Routes = [];
|
|
1845
|
+
* bootstrapApplication(AppComponent, {
|
|
1846
|
+
* providers: [provideRouter(appRoutes)]
|
|
1847
|
+
* });
|
|
1848
|
+
* ```
|
|
1849
|
+
*
|
|
1850
|
+
* You can also enable optional features in the Router by adding functions from the `RouterFeatures`
|
|
1851
|
+
* type:
|
|
1852
|
+
* ```
|
|
1853
|
+
* const appRoutes: Routes = [];
|
|
1854
|
+
* bootstrapApplication(AppComponent,
|
|
1855
|
+
* {
|
|
1856
|
+
* providers: [
|
|
1857
|
+
* provideRouter(appRoutes,
|
|
1858
|
+
* withDebugTracing(),
|
|
1859
|
+
* withRouterConfig({paramsInheritanceStrategy: 'always'}))
|
|
1860
|
+
* ]
|
|
1861
|
+
* }
|
|
1862
|
+
* );
|
|
1863
|
+
* ```
|
|
1864
|
+
*
|
|
1865
|
+
* @see `RouterFeatures`
|
|
1866
|
+
*
|
|
1867
|
+
* @publicApi
|
|
1868
|
+
* @developerPreview
|
|
1869
|
+
* @param routes A set of `Route`s to use for the application routing table.
|
|
1870
|
+
* @param features Optional features to configure additional router behaviors.
|
|
1871
|
+
* @returns A set of providers to setup a Router.
|
|
1872
|
+
*/
|
|
1873
|
+
export declare function provideRouter(routes: Routes, ...features: RouterFeatures[]): Provider[];
|
|
1874
|
+
|
|
1804
1875
|
/**
|
|
1805
1876
|
* Registers a [DI provider](guide/glossary#provider) for a set of routes.
|
|
1806
1877
|
* @param routes The route configuration to provide.
|
|
@@ -1809,10 +1880,9 @@ export declare const PRIMARY_OUTLET = "primary";
|
|
|
1809
1880
|
*
|
|
1810
1881
|
* ```
|
|
1811
1882
|
* @NgModule({
|
|
1812
|
-
*
|
|
1813
|
-
* providers: [provideRoutes(EXTRA_ROUTES)]
|
|
1883
|
+
* providers: [provideRoutes(ROUTES)]
|
|
1814
1884
|
* })
|
|
1815
|
-
* class
|
|
1885
|
+
* class LazyLoadedChildModule {}
|
|
1816
1886
|
* ```
|
|
1817
1887
|
*
|
|
1818
1888
|
* @publicApi
|
|
@@ -1880,7 +1950,7 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
|
|
|
1880
1950
|
* export class AppRoutingModule {}
|
|
1881
1951
|
* ```
|
|
1882
1952
|
*
|
|
1883
|
-
* You can alternatively provide an in-line function with the `
|
|
1953
|
+
* You can alternatively provide an in-line function with the `ResolveFn` signature:
|
|
1884
1954
|
*
|
|
1885
1955
|
* ```
|
|
1886
1956
|
* export const myHero: Hero = {
|
|
@@ -1894,17 +1964,11 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
|
|
|
1894
1964
|
* path: 'detail/:id',
|
|
1895
1965
|
* component: HeroComponent,
|
|
1896
1966
|
* resolve: {
|
|
1897
|
-
* hero:
|
|
1967
|
+
* hero: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => myHero
|
|
1898
1968
|
* }
|
|
1899
1969
|
* }
|
|
1900
1970
|
* ])
|
|
1901
1971
|
* ],
|
|
1902
|
-
* providers: [
|
|
1903
|
-
* {
|
|
1904
|
-
* provide: 'heroResolver',
|
|
1905
|
-
* useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => myHero
|
|
1906
|
-
* }
|
|
1907
|
-
* ]
|
|
1908
1972
|
* })
|
|
1909
1973
|
* export class AppModule {}
|
|
1910
1974
|
* ```
|
|
@@ -1967,7 +2031,7 @@ export declare interface Resolve<T> {
|
|
|
1967
2031
|
* @publicApi
|
|
1968
2032
|
*/
|
|
1969
2033
|
export declare type ResolveData = {
|
|
1970
|
-
[key: string | symbol]: any
|
|
2034
|
+
[key: string | symbol]: any | ResolveFn<unknown>;
|
|
1971
2035
|
};
|
|
1972
2036
|
|
|
1973
2037
|
/**
|
|
@@ -1994,6 +2058,14 @@ export declare class ResolveEnd extends RouterEvent {
|
|
|
1994
2058
|
toString(): string;
|
|
1995
2059
|
}
|
|
1996
2060
|
|
|
2061
|
+
/**
|
|
2062
|
+
* Function type definition for a data provider.
|
|
2063
|
+
*
|
|
2064
|
+
* @see `Route#resolve`.
|
|
2065
|
+
* @publicApi
|
|
2066
|
+
*/
|
|
2067
|
+
export declare type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<T> | Promise<T> | T;
|
|
2068
|
+
|
|
1997
2069
|
/**
|
|
1998
2070
|
* An event triggered at the start of the Resolve phase of routing.
|
|
1999
2071
|
*
|
|
@@ -2254,7 +2326,7 @@ export declare interface Route {
|
|
|
2254
2326
|
*
|
|
2255
2327
|
* @see `PageTitleStrategy`
|
|
2256
2328
|
*/
|
|
2257
|
-
title?: string | Type<Resolve<string
|
|
2329
|
+
title?: string | Type<Resolve<string>> | ResolveFn<string>;
|
|
2258
2330
|
/**
|
|
2259
2331
|
* The path to match against. Cannot be used together with a custom `matcher` function.
|
|
2260
2332
|
* A URL string that uses router matching notation.
|
|
@@ -2311,36 +2383,50 @@ export declare interface Route {
|
|
|
2311
2383
|
*/
|
|
2312
2384
|
outlet?: string;
|
|
2313
2385
|
/**
|
|
2314
|
-
* An array of
|
|
2386
|
+
* An array of `CanActivateFn` or DI tokens used to look up `CanActivate()`
|
|
2315
2387
|
* handlers, in order to determine if the current user is allowed to
|
|
2316
2388
|
* activate the component. By default, any user can activate.
|
|
2389
|
+
*
|
|
2390
|
+
* When using a function rather than DI tokens, the function can call `inject` to get any required
|
|
2391
|
+
* dependencies. This `inject` call must be done in a synchronous context.
|
|
2317
2392
|
*/
|
|
2318
|
-
canActivate?: any
|
|
2393
|
+
canActivate?: Array<CanActivateFn | any>;
|
|
2319
2394
|
/**
|
|
2320
|
-
* An array of DI tokens used to look up `CanMatch()`
|
|
2395
|
+
* An array of `CanMatchFn` or DI tokens used to look up `CanMatch()`
|
|
2321
2396
|
* handlers, in order to determine if the current user is allowed to
|
|
2322
2397
|
* match the `Route`. By default, any route can match.
|
|
2398
|
+
*
|
|
2399
|
+
* When using a function rather than DI tokens, the function can call `inject` to get any required
|
|
2400
|
+
* dependencies. This `inject` call must be done in a synchronous context.
|
|
2323
2401
|
*/
|
|
2324
|
-
canMatch?: Array<Type<CanMatch> | InjectionToken<CanMatchFn
|
|
2402
|
+
canMatch?: Array<Type<CanMatch> | InjectionToken<CanMatchFn> | CanMatchFn>;
|
|
2325
2403
|
/**
|
|
2326
|
-
* An array of DI tokens used to look up `CanActivateChild()` handlers,
|
|
2404
|
+
* An array of `CanActivateChildFn` or DI tokens used to look up `CanActivateChild()` handlers,
|
|
2327
2405
|
* in order to determine if the current user is allowed to activate
|
|
2328
2406
|
* a child of the component. By default, any user can activate a child.
|
|
2407
|
+
*
|
|
2408
|
+
* When using a function rather than DI tokens, the function can call `inject` to get any required
|
|
2409
|
+
* dependencies. This `inject` call must be done in a synchronous context.
|
|
2329
2410
|
*/
|
|
2330
|
-
canActivateChild?: any
|
|
2411
|
+
canActivateChild?: Array<CanActivateChildFn | any>;
|
|
2331
2412
|
/**
|
|
2332
|
-
* An array of DI tokens used to look up `CanDeactivate()`
|
|
2413
|
+
* An array of `CanDeactivateFn` or DI tokens used to look up `CanDeactivate()`
|
|
2333
2414
|
* handlers, in order to determine if the current user is allowed to
|
|
2334
2415
|
* deactivate the component. By default, any user can deactivate.
|
|
2335
2416
|
*
|
|
2417
|
+
* When using a function rather than DI tokens, the function can call `inject` to get any required
|
|
2418
|
+
* dependencies. This `inject` call must be done in a synchronous context.
|
|
2336
2419
|
*/
|
|
2337
|
-
canDeactivate?: any
|
|
2420
|
+
canDeactivate?: Array<CanDeactivateFn<any> | any>;
|
|
2338
2421
|
/**
|
|
2339
|
-
* An array of DI tokens used to look up `CanLoad()`
|
|
2422
|
+
* An array of `CanLoadFn` or DI tokens used to look up `CanLoad()`
|
|
2340
2423
|
* handlers, in order to determine if the current user is allowed to
|
|
2341
2424
|
* load the component. By default, any user can load.
|
|
2425
|
+
*
|
|
2426
|
+
* When using a function rather than DI tokens, the function can call `inject` to get any required
|
|
2427
|
+
* dependencies. This `inject` call must be done in a synchronous context.
|
|
2342
2428
|
*/
|
|
2343
|
-
canLoad?: any
|
|
2429
|
+
canLoad?: Array<CanLoadFn | any>;
|
|
2344
2430
|
/**
|
|
2345
2431
|
* Additional developer-defined data provided to the component via
|
|
2346
2432
|
* `ActivatedRoute`. By default, no additional data is passed.
|
|
@@ -2811,6 +2897,79 @@ declare class RouterConfigLoader {
|
|
|
2811
2897
|
static ɵprov: i0.ɵɵInjectableDeclaration<RouterConfigLoader>;
|
|
2812
2898
|
}
|
|
2813
2899
|
|
|
2900
|
+
/**
|
|
2901
|
+
* Extra configuration options that can be used with the `withRouterConfig` function.
|
|
2902
|
+
*
|
|
2903
|
+
* @publicApi
|
|
2904
|
+
* @developerPreview
|
|
2905
|
+
*/
|
|
2906
|
+
export declare interface RouterConfigOptions {
|
|
2907
|
+
/**
|
|
2908
|
+
* Configures how the Router attempts to restore state when a navigation is cancelled.
|
|
2909
|
+
*
|
|
2910
|
+
* 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
|
|
2911
|
+
* router before the navigation started. This means that if the URL of the browser is updated
|
|
2912
|
+
* _before_ the navigation is canceled, the Router will simply replace the item in history rather
|
|
2913
|
+
* than trying to restore to the previous location in the session history. This happens most
|
|
2914
|
+
* frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
|
|
2915
|
+
* buttons.
|
|
2916
|
+
*
|
|
2917
|
+
* 'computed' - Will attempt to return to the same index in the session history that corresponds
|
|
2918
|
+
* to the Angular route when the navigation gets cancelled. For example, if the browser back
|
|
2919
|
+
* button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
|
|
2920
|
+
* and vice versa.
|
|
2921
|
+
*
|
|
2922
|
+
* Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
|
|
2923
|
+
* handles a portion of the URL because the history restoration navigates to the previous place in
|
|
2924
|
+
* the browser history rather than simply resetting a portion of the URL.
|
|
2925
|
+
*
|
|
2926
|
+
* The default value is `replace` when not set.
|
|
2927
|
+
*/
|
|
2928
|
+
canceledNavigationResolution?: 'replace' | 'computed';
|
|
2929
|
+
/**
|
|
2930
|
+
* Define what the router should do if it receives a navigation request to the current URL.
|
|
2931
|
+
* Default is `ignore`, which causes the router ignores the navigation.
|
|
2932
|
+
* This can disable features such as a "refresh" button.
|
|
2933
|
+
* Use this option to configure the behavior when navigating to the
|
|
2934
|
+
* current URL. Default is 'ignore'.
|
|
2935
|
+
*/
|
|
2936
|
+
onSameUrlNavigation?: 'reload' | 'ignore';
|
|
2937
|
+
/**
|
|
2938
|
+
* Defines how the router merges parameters, data, and resolved data from parent to child
|
|
2939
|
+
* routes. By default ('emptyOnly'), inherits parent parameters only for
|
|
2940
|
+
* path-less or component-less routes.
|
|
2941
|
+
*
|
|
2942
|
+
* Set to 'always' to enable unconditional inheritance of parent parameters.
|
|
2943
|
+
*
|
|
2944
|
+
* Note that when dealing with matrix parameters, "parent" refers to the parent `Route`
|
|
2945
|
+
* config which does not necessarily mean the "URL segment to the left". When the `Route` `path`
|
|
2946
|
+
* contains multiple segments, the matrix parameters must appear on the last segment. For example,
|
|
2947
|
+
* matrix parameters for `{path: 'a/b', component: MyComp}` should appear as `a/b;foo=bar` and not
|
|
2948
|
+
* `a;foo=bar/b`.
|
|
2949
|
+
*
|
|
2950
|
+
*/
|
|
2951
|
+
paramsInheritanceStrategy?: 'emptyOnly' | 'always';
|
|
2952
|
+
/**
|
|
2953
|
+
* Defines when the router updates the browser URL. By default ('deferred'),
|
|
2954
|
+
* update after successful navigation.
|
|
2955
|
+
* Set to 'eager' if prefer to update the URL at the beginning of navigation.
|
|
2956
|
+
* Updating the URL early allows you to handle a failure of navigation by
|
|
2957
|
+
* showing an error message with the URL that failed.
|
|
2958
|
+
*/
|
|
2959
|
+
urlUpdateStrategy?: 'deferred' | 'eager';
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
/**
|
|
2963
|
+
* A type alias for providers returned by `withRouterConfig` for use with `provideRouter`.
|
|
2964
|
+
*
|
|
2965
|
+
* @see `withRouterConfig`
|
|
2966
|
+
* @see `provideRouter`
|
|
2967
|
+
*
|
|
2968
|
+
* @publicApi
|
|
2969
|
+
* @developerPreview
|
|
2970
|
+
*/
|
|
2971
|
+
export declare type RouterConfigurationFeature = RouterFeature<RouterFeatureKind.RouterConfigurationFeature>;
|
|
2972
|
+
|
|
2814
2973
|
/**
|
|
2815
2974
|
* @description
|
|
2816
2975
|
*
|
|
@@ -2871,6 +3030,42 @@ export declare class RouterEvent {
|
|
|
2871
3030
|
url: string);
|
|
2872
3031
|
}
|
|
2873
3032
|
|
|
3033
|
+
/**
|
|
3034
|
+
* Helper type to represent a Router feature.
|
|
3035
|
+
*
|
|
3036
|
+
* @publicApi
|
|
3037
|
+
* @developerPreview
|
|
3038
|
+
*/
|
|
3039
|
+
export declare interface RouterFeature<FeatureKind extends RouterFeatureKind> {
|
|
3040
|
+
ɵkind: FeatureKind;
|
|
3041
|
+
ɵproviders: Provider[];
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
/**
|
|
3045
|
+
* The list of features as an enum to uniquely type each feature.
|
|
3046
|
+
*/
|
|
3047
|
+
declare const enum RouterFeatureKind {
|
|
3048
|
+
PreloadingFeature = 0,
|
|
3049
|
+
DebugTracingFeature = 1,
|
|
3050
|
+
EnabledBlockingInitialNavigationFeature = 2,
|
|
3051
|
+
DisabledInitialNavigationFeature = 3,
|
|
3052
|
+
InMemoryScrollingFeature = 4,
|
|
3053
|
+
RouterConfigurationFeature = 5
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
/**
|
|
3057
|
+
* A type alias that represents all Router features available for use with `provideRouter`.
|
|
3058
|
+
* Features can be enabled by adding special functions to the `provideRouter` call.
|
|
3059
|
+
* See documentation for each symbol to find corresponding function name. See also `provideRouter`
|
|
3060
|
+
* documentation on how to use those functions.
|
|
3061
|
+
*
|
|
3062
|
+
* @see `provideRouter`
|
|
3063
|
+
*
|
|
3064
|
+
* @publicApi
|
|
3065
|
+
* @developerPreview
|
|
3066
|
+
*/
|
|
3067
|
+
export declare type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature;
|
|
3068
|
+
|
|
2874
3069
|
/**
|
|
2875
3070
|
* @description
|
|
2876
3071
|
*
|
|
@@ -2974,6 +3169,9 @@ export declare class RouterLink implements OnChanges {
|
|
|
2974
3169
|
private readonly tabIndexAttribute;
|
|
2975
3170
|
private readonly renderer;
|
|
2976
3171
|
private readonly el;
|
|
3172
|
+
private _preserveFragment;
|
|
3173
|
+
private _skipLocationChange;
|
|
3174
|
+
private _replaceUrl;
|
|
2977
3175
|
/**
|
|
2978
3176
|
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
2979
3177
|
* `UrlCreationOptions`.
|
|
@@ -2995,27 +3193,6 @@ export declare class RouterLink implements OnChanges {
|
|
|
2995
3193
|
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
2996
3194
|
*/
|
|
2997
3195
|
queryParamsHandling?: QueryParamsHandling | null;
|
|
2998
|
-
/**
|
|
2999
|
-
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
3000
|
-
* `UrlCreationOptions`.
|
|
3001
|
-
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
3002
|
-
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
3003
|
-
*/
|
|
3004
|
-
preserveFragment: boolean;
|
|
3005
|
-
/**
|
|
3006
|
-
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3007
|
-
* `NavigationBehaviorOptions`.
|
|
3008
|
-
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
3009
|
-
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3010
|
-
*/
|
|
3011
|
-
skipLocationChange: boolean;
|
|
3012
|
-
/**
|
|
3013
|
-
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3014
|
-
* `NavigationBehaviorOptions`.
|
|
3015
|
-
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
3016
|
-
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3017
|
-
*/
|
|
3018
|
-
replaceUrl: boolean;
|
|
3019
3196
|
/**
|
|
3020
3197
|
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3021
3198
|
* `NavigationBehaviorOptions`.
|
|
@@ -3037,6 +3214,30 @@ export declare class RouterLink implements OnChanges {
|
|
|
3037
3214
|
relativeTo?: ActivatedRoute | null;
|
|
3038
3215
|
private commands;
|
|
3039
3216
|
constructor(router: Router, route: ActivatedRoute, tabIndexAttribute: string | null | undefined, renderer: Renderer2, el: ElementRef);
|
|
3217
|
+
/**
|
|
3218
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
3219
|
+
* `UrlCreationOptions`.
|
|
3220
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
3221
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
3222
|
+
*/
|
|
3223
|
+
set preserveFragment(preserveFragment: boolean | string | null | undefined);
|
|
3224
|
+
get preserveFragment(): boolean;
|
|
3225
|
+
/**
|
|
3226
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3227
|
+
* `NavigationBehaviorOptions`.
|
|
3228
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
3229
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3230
|
+
*/
|
|
3231
|
+
set skipLocationChange(skipLocationChange: boolean | string | null | undefined);
|
|
3232
|
+
get skipLocationChange(): boolean;
|
|
3233
|
+
/**
|
|
3234
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3235
|
+
* `NavigationBehaviorOptions`.
|
|
3236
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
3237
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3238
|
+
*/
|
|
3239
|
+
set replaceUrl(replaceUrl: boolean | string | null | undefined);
|
|
3240
|
+
get replaceUrl(): boolean;
|
|
3040
3241
|
/**
|
|
3041
3242
|
* Modifies the tab index if there was not a tabindex attribute on the element during
|
|
3042
3243
|
* instantiation.
|
|
@@ -3056,7 +3257,7 @@ export declare class RouterLink implements OnChanges {
|
|
|
3056
3257
|
onClick(): boolean;
|
|
3057
3258
|
get urlTree(): UrlTree | null;
|
|
3058
3259
|
static ɵfac: i0.ɵɵFactoryDeclaration<RouterLink, [null, null, { attribute: "tabindex"; }, null, null]>;
|
|
3059
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLink, ":not(a):not(area)[routerLink]", never, { "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "
|
|
3260
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLink, ":not(a):not(area)[routerLink]", never, { "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "state": "state"; "relativeTo": "relativeTo"; "preserveFragment": "preserveFragment"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; "routerLink": "routerLink"; }, {}, never, never, true>;
|
|
3060
3261
|
}
|
|
3061
3262
|
|
|
3062
3263
|
/**
|
|
@@ -3207,6 +3408,9 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
|
|
|
3207
3408
|
private router;
|
|
3208
3409
|
private route;
|
|
3209
3410
|
private locationStrategy;
|
|
3411
|
+
private _preserveFragment;
|
|
3412
|
+
private _skipLocationChange;
|
|
3413
|
+
private _replaceUrl;
|
|
3210
3414
|
target: string;
|
|
3211
3415
|
/**
|
|
3212
3416
|
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
@@ -3229,27 +3433,6 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
|
|
|
3229
3433
|
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
3230
3434
|
*/
|
|
3231
3435
|
queryParamsHandling?: QueryParamsHandling | null;
|
|
3232
|
-
/**
|
|
3233
|
-
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
3234
|
-
* `UrlCreationOptions`.
|
|
3235
|
-
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
3236
|
-
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
3237
|
-
*/
|
|
3238
|
-
preserveFragment: boolean;
|
|
3239
|
-
/**
|
|
3240
|
-
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3241
|
-
* `NavigationBehaviorOptions`.
|
|
3242
|
-
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
3243
|
-
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3244
|
-
*/
|
|
3245
|
-
skipLocationChange: boolean;
|
|
3246
|
-
/**
|
|
3247
|
-
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3248
|
-
* `NavigationBehaviorOptions`.
|
|
3249
|
-
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
3250
|
-
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3251
|
-
*/
|
|
3252
|
-
replaceUrl: boolean;
|
|
3253
3436
|
/**
|
|
3254
3437
|
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3255
3438
|
* `NavigationBehaviorOptions`.
|
|
@@ -3273,6 +3456,30 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
|
|
|
3273
3456
|
private subscription;
|
|
3274
3457
|
href: string | null;
|
|
3275
3458
|
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
|
|
3459
|
+
/**
|
|
3460
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
3461
|
+
* `UrlCreationOptions`.
|
|
3462
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
3463
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
3464
|
+
*/
|
|
3465
|
+
set preserveFragment(preserveFragment: boolean | string | null | undefined);
|
|
3466
|
+
get preserveFragment(): boolean;
|
|
3467
|
+
/**
|
|
3468
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3469
|
+
* `NavigationBehaviorOptions`.
|
|
3470
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
3471
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3472
|
+
*/
|
|
3473
|
+
set skipLocationChange(skipLocationChange: boolean | string | null | undefined);
|
|
3474
|
+
get skipLocationChange(): boolean;
|
|
3475
|
+
/**
|
|
3476
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
3477
|
+
* `NavigationBehaviorOptions`.
|
|
3478
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
3479
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
3480
|
+
*/
|
|
3481
|
+
set replaceUrl(replaceUrl: boolean | string | null | undefined);
|
|
3482
|
+
get replaceUrl(): boolean;
|
|
3276
3483
|
/**
|
|
3277
3484
|
* Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
3278
3485
|
* - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
@@ -3290,7 +3497,7 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
|
|
|
3290
3497
|
private updateTargetUrlAndHref;
|
|
3291
3498
|
get urlTree(): UrlTree | null;
|
|
3292
3499
|
static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkWithHref, never>;
|
|
3293
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkWithHref, "a[routerLink],area[routerLink]", never, { "target": "target"; "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "
|
|
3500
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkWithHref, "a[routerLink],area[routerLink]", never, { "target": "target"; "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "state": "state"; "relativeTo": "relativeTo"; "preserveFragment": "preserveFragment"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; "routerLink": "routerLink"; }, {}, never, never, true>;
|
|
3294
3501
|
}
|
|
3295
3502
|
|
|
3296
3503
|
/**
|
|
@@ -4094,6 +4301,179 @@ export declare class UrlTree {
|
|
|
4094
4301
|
*/
|
|
4095
4302
|
export declare const VERSION: Version;
|
|
4096
4303
|
|
|
4304
|
+
/**
|
|
4305
|
+
* Enables logging of all internal navigation events to the console.
|
|
4306
|
+
* Extra logging might be useful for debugging purposes to inspect Router event sequence.
|
|
4307
|
+
*
|
|
4308
|
+
* @usageNotes
|
|
4309
|
+
*
|
|
4310
|
+
* Basic example of how you can enable debug tracing:
|
|
4311
|
+
* ```
|
|
4312
|
+
* const appRoutes: Routes = [];
|
|
4313
|
+
* bootstrapApplication(AppComponent,
|
|
4314
|
+
* {
|
|
4315
|
+
* providers: [
|
|
4316
|
+
* provideRouter(appRoutes, withDebugTracing())
|
|
4317
|
+
* ]
|
|
4318
|
+
* }
|
|
4319
|
+
* );
|
|
4320
|
+
* ```
|
|
4321
|
+
*
|
|
4322
|
+
* @see `provideRouter`
|
|
4323
|
+
*
|
|
4324
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
4325
|
+
*
|
|
4326
|
+
* @publicApi
|
|
4327
|
+
* @developerPreview
|
|
4328
|
+
*/
|
|
4329
|
+
export declare function withDebugTracing(): DebugTracingFeature;
|
|
4330
|
+
|
|
4331
|
+
/**
|
|
4332
|
+
* Disables initial navigation.
|
|
4333
|
+
*
|
|
4334
|
+
* Use if there is a reason to have more control over when the router starts its initial navigation
|
|
4335
|
+
* due to some complex initialization logic.
|
|
4336
|
+
*
|
|
4337
|
+
* @usageNotes
|
|
4338
|
+
*
|
|
4339
|
+
* Basic example of how you can disable initial navigation:
|
|
4340
|
+
* ```
|
|
4341
|
+
* const appRoutes: Routes = [];
|
|
4342
|
+
* bootstrapApplication(AppComponent,
|
|
4343
|
+
* {
|
|
4344
|
+
* providers: [
|
|
4345
|
+
* provideRouter(appRoutes, withDisabledInitialNavigation())
|
|
4346
|
+
* ]
|
|
4347
|
+
* }
|
|
4348
|
+
* );
|
|
4349
|
+
* ```
|
|
4350
|
+
*
|
|
4351
|
+
* @see `provideRouter`
|
|
4352
|
+
*
|
|
4353
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
4354
|
+
*
|
|
4355
|
+
* @publicApi
|
|
4356
|
+
* @developerPreview
|
|
4357
|
+
*/
|
|
4358
|
+
export declare function withDisabledInitialNavigation(): DisabledInitialNavigationFeature;
|
|
4359
|
+
|
|
4360
|
+
/**
|
|
4361
|
+
* Configures initial navigation to start before the root component is created.
|
|
4362
|
+
*
|
|
4363
|
+
* The bootstrap is blocked until the initial navigation is complete. This value is required for
|
|
4364
|
+
* [server-side rendering](guide/universal) to work.
|
|
4365
|
+
*
|
|
4366
|
+
* @usageNotes
|
|
4367
|
+
*
|
|
4368
|
+
* Basic example of how you can enable this navigation behavior:
|
|
4369
|
+
* ```
|
|
4370
|
+
* const appRoutes: Routes = [];
|
|
4371
|
+
* bootstrapApplication(AppComponent,
|
|
4372
|
+
* {
|
|
4373
|
+
* providers: [
|
|
4374
|
+
* provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
|
|
4375
|
+
* ]
|
|
4376
|
+
* }
|
|
4377
|
+
* );
|
|
4378
|
+
* ```
|
|
4379
|
+
*
|
|
4380
|
+
* @see `provideRouter`
|
|
4381
|
+
*
|
|
4382
|
+
* @publicApi
|
|
4383
|
+
* @developerPreview
|
|
4384
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
4385
|
+
*/
|
|
4386
|
+
export declare function withEnabledBlockingInitialNavigation(): EnabledBlockingInitialNavigationFeature;
|
|
4387
|
+
|
|
4388
|
+
/**
|
|
4389
|
+
* Enables customizable scrolling behavior for router navigations.
|
|
4390
|
+
*
|
|
4391
|
+
* @usageNotes
|
|
4392
|
+
*
|
|
4393
|
+
* Basic example of how you can enable scrolling feature:
|
|
4394
|
+
* ```
|
|
4395
|
+
* const appRoutes: Routes = [];
|
|
4396
|
+
* bootstrapApplication(AppComponent,
|
|
4397
|
+
* {
|
|
4398
|
+
* providers: [
|
|
4399
|
+
* provideRouter(appRoutes, withInMemoryScrolling())
|
|
4400
|
+
* ]
|
|
4401
|
+
* }
|
|
4402
|
+
* );
|
|
4403
|
+
* ```
|
|
4404
|
+
*
|
|
4405
|
+
* @see `provideRouter`
|
|
4406
|
+
* @see `ViewportScroller`
|
|
4407
|
+
*
|
|
4408
|
+
* @publicApi
|
|
4409
|
+
* @developerPreview
|
|
4410
|
+
* @param options Set of configuration parameters to customize scrolling behavior, see
|
|
4411
|
+
* `InMemoryScrollingOptions` for additional information.
|
|
4412
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
4413
|
+
*/
|
|
4414
|
+
export declare function withInMemoryScrolling(options?: InMemoryScrollingOptions): InMemoryScrollingFeature;
|
|
4415
|
+
|
|
4416
|
+
/**
|
|
4417
|
+
* Allows to configure a preloading strategy to use. The strategy is configured by providing a
|
|
4418
|
+
* reference to a class that implements a `PreloadingStrategy`.
|
|
4419
|
+
*
|
|
4420
|
+
* @usageNotes
|
|
4421
|
+
*
|
|
4422
|
+
* Basic example of how you can configure preloading:
|
|
4423
|
+
* ```
|
|
4424
|
+
* const appRoutes: Routes = [];
|
|
4425
|
+
* bootstrapApplication(AppComponent,
|
|
4426
|
+
* {
|
|
4427
|
+
* providers: [
|
|
4428
|
+
* provideRouter(appRoutes, withPreloading(PreloadAllModules))
|
|
4429
|
+
* ]
|
|
4430
|
+
* }
|
|
4431
|
+
* );
|
|
4432
|
+
* ```
|
|
4433
|
+
*
|
|
4434
|
+
* @see `provideRouter`
|
|
4435
|
+
*
|
|
4436
|
+
* @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
|
|
4437
|
+
* should be used.
|
|
4438
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
4439
|
+
*
|
|
4440
|
+
* @publicApi
|
|
4441
|
+
* @developerPreview
|
|
4442
|
+
*/
|
|
4443
|
+
declare function withPreloading(preloadingStrategy: Type<PreloadingStrategy>): PreloadingFeature;
|
|
4444
|
+
export { withPreloading }
|
|
4445
|
+
export { withPreloading as ɵwithPreloading }
|
|
4446
|
+
|
|
4447
|
+
/**
|
|
4448
|
+
* Allows to provide extra parameters to configure Router.
|
|
4449
|
+
*
|
|
4450
|
+
* @usageNotes
|
|
4451
|
+
*
|
|
4452
|
+
* Basic example of how you can provide extra configuration options:
|
|
4453
|
+
* ```
|
|
4454
|
+
* const appRoutes: Routes = [];
|
|
4455
|
+
* bootstrapApplication(AppComponent,
|
|
4456
|
+
* {
|
|
4457
|
+
* providers: [
|
|
4458
|
+
* provideRouter(appRoutes, withRouterConfig({
|
|
4459
|
+
* onSameUrlNavigation: 'reload'
|
|
4460
|
+
* }))
|
|
4461
|
+
* ]
|
|
4462
|
+
* }
|
|
4463
|
+
* );
|
|
4464
|
+
* ```
|
|
4465
|
+
*
|
|
4466
|
+
* @see `provideRouter`
|
|
4467
|
+
*
|
|
4468
|
+
* @param options A set of parameters to configure Router, see `RouterConfigOptions` for
|
|
4469
|
+
* additional information.
|
|
4470
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
4471
|
+
*
|
|
4472
|
+
* @publicApi
|
|
4473
|
+
* @developerPreview
|
|
4474
|
+
*/
|
|
4475
|
+
export declare function withRouterConfig(options: RouterConfigOptions): RouterConfigurationFeature;
|
|
4476
|
+
|
|
4097
4477
|
export declare function ɵassignExtraOptionsToRouter(opts: ExtraOptions, router: Router): void;
|
|
4098
4478
|
|
|
4099
4479
|
/**
|
|
@@ -4115,8 +4495,6 @@ export declare class ɵEmptyOutletComponent {
|
|
|
4115
4495
|
*/
|
|
4116
4496
|
export declare function ɵflatten<T>(arr: T[][]): T[];
|
|
4117
4497
|
|
|
4118
|
-
export declare function ɵprovidePreloading(preloadingStrategy: Type<PreloadingStrategy>): Provider[];
|
|
4119
|
-
|
|
4120
4498
|
export declare type ɵRestoredState = {
|
|
4121
4499
|
[k: string]: any;
|
|
4122
4500
|
navigationId: number;
|