@angular/router 14.1.3 → 14.2.0-rc.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.
Files changed (39) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +10 -6
  2. package/esm2020/src/directives/router_link.mjs +106 -25
  3. package/esm2020/src/directives/router_link_active.mjs +5 -4
  4. package/esm2020/src/directives/router_outlet.mjs +9 -5
  5. package/esm2020/src/index.mjs +4 -3
  6. package/esm2020/src/models.mjs +1 -1
  7. package/esm2020/src/operators/check_guards.mjs +36 -26
  8. package/esm2020/src/operators/resolve_data.mjs +19 -21
  9. package/esm2020/src/page_title_strategy.mjs +9 -10
  10. package/esm2020/src/private_export.mjs +3 -2
  11. package/esm2020/src/provide_router.mjs +420 -0
  12. package/esm2020/src/router.mjs +3 -3
  13. package/esm2020/src/router_config.mjs +1 -1
  14. package/esm2020/src/router_config_loader.mjs +3 -3
  15. package/esm2020/src/router_module.mjs +27 -185
  16. package/esm2020/src/router_outlet_context.mjs +3 -3
  17. package/esm2020/src/router_preloader.mjs +12 -11
  18. package/esm2020/src/router_scroller.mjs +3 -3
  19. package/esm2020/src/router_state.mjs +7 -3
  20. package/esm2020/src/shared.mjs +22 -2
  21. package/esm2020/src/url_tree.mjs +3 -3
  22. package/esm2020/src/utils/preactivation.mjs +16 -6
  23. package/esm2020/src/version.mjs +1 -1
  24. package/esm2020/testing/src/provide_router_for_testing.mjs +51 -0
  25. package/esm2020/testing/src/router_testing_module.mjs +8 -8
  26. package/fesm2015/router.mjs +722 -332
  27. package/fesm2015/router.mjs.map +1 -1
  28. package/fesm2015/testing.mjs +8 -8
  29. package/fesm2015/testing.mjs.map +1 -1
  30. package/fesm2015/upgrade.mjs +1 -1
  31. package/fesm2020/router.mjs +714 -330
  32. package/fesm2020/router.mjs.map +1 -1
  33. package/fesm2020/testing.mjs +8 -8
  34. package/fesm2020/testing.mjs.map +1 -1
  35. package/fesm2020/upgrade.mjs +1 -1
  36. package/index.d.ts +614 -215
  37. package/package.json +4 -4
  38. package/testing/index.d.ts +1 -1
  39. package/upgrade/index.d.ts +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.1.3
2
+ * @license Angular v14.2.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -70,6 +70,8 @@ export declare class ActivatedRoute {
70
70
  component: Type<any> | null;
71
71
  /** The current snapshot of this route */
72
72
  snapshot: ActivatedRouteSnapshot;
73
+ /** An Observable of the resolved route title */
74
+ readonly title: Observable<string | undefined>;
73
75
  /** The configuration used to match this route. */
74
76
  get routeConfig(): Route | null;
75
77
  /** The root of the router state. */
@@ -154,6 +156,8 @@ export declare class ActivatedRouteSnapshot {
154
156
  component: Type<any> | null;
155
157
  /** The configuration used to match this route **/
156
158
  readonly routeConfig: Route | null;
159
+ /** The resolved route title */
160
+ readonly title?: string;
157
161
  /** The root of the router state */
158
162
  get root(): ActivatedRouteSnapshot;
159
163
  /** The parent of this route in the router state tree */
@@ -258,7 +262,7 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
258
262
  * ```
259
263
  * class UserToken {}
260
264
  * class Permissions {
261
- * canActivate(user: UserToken, id: string): boolean {
265
+ * canActivate(): boolean {
262
266
  * return true;
263
267
  * }
264
268
  * }
@@ -295,7 +299,7 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
295
299
  * class AppModule {}
296
300
  * ```
297
301
  *
298
- * You can alternatively provide an in-line function with the `canActivate` signature:
302
+ * You can alternatively provide an in-line function with the `CanActivateFn` signature:
299
303
  *
300
304
  * ```
301
305
  * @NgModule({
@@ -304,16 +308,10 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
304
308
  * {
305
309
  * path: 'team/:id',
306
310
  * component: TeamComponent,
307
- * canActivate: ['canActivateTeam']
311
+ * canActivate: [(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true]
308
312
  * }
309
313
  * ])
310
314
  * ],
311
- * providers: [
312
- * {
313
- * provide: 'canActivateTeam',
314
- * useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true
315
- * }
316
- * ]
317
315
  * })
318
316
  * class AppModule {}
319
317
  * ```
@@ -380,7 +378,7 @@ export declare interface CanActivate {
380
378
  * class AppModule {}
381
379
  * ```
382
380
  *
383
- * You can alternatively provide an in-line function with the `canActivateChild` signature:
381
+ * You can alternatively provide an in-line function with the `CanActivateChildFn` signature:
384
382
  *
385
383
  * ```
386
384
  * @NgModule({
@@ -388,7 +386,7 @@ export declare interface CanActivate {
388
386
  * RouterModule.forRoot([
389
387
  * {
390
388
  * path: 'root',
391
- * canActivateChild: ['canActivateTeam'],
389
+ * canActivateChild: [(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true],
392
390
  * children: [
393
391
  * {
394
392
  * path: 'team/:id',
@@ -398,12 +396,6 @@ export declare interface CanActivate {
398
396
  * }
399
397
  * ])
400
398
  * ],
401
- * providers: [
402
- * {
403
- * provide: 'canActivateTeam',
404
- * useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true
405
- * }
406
- * ]
407
399
  * })
408
400
  * class AppModule {}
409
401
  * ```
@@ -414,6 +406,24 @@ export declare interface CanActivateChild {
414
406
  canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
415
407
  }
416
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
+
417
427
  /**
418
428
  * @description
419
429
  *
@@ -468,7 +478,7 @@ export declare interface CanActivateChild {
468
478
  * class AppModule {}
469
479
  * ```
470
480
  *
471
- * You can alternatively provide an in-line function with the `canDeactivate` signature:
481
+ * You can alternatively provide an in-line function with the `CanDeactivateFn` signature:
472
482
  *
473
483
  * ```
474
484
  * @NgModule({
@@ -477,17 +487,11 @@ export declare interface CanActivateChild {
477
487
  * {
478
488
  * path: 'team/:id',
479
489
  * component: TeamComponent,
480
- * canDeactivate: ['canDeactivateTeam']
490
+ * canDeactivate: [(component: TeamComponent, currentRoute: ActivatedRouteSnapshot,
491
+ * currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => true]
481
492
  * }
482
493
  * ])
483
494
  * ],
484
- * providers: [
485
- * {
486
- * provide: 'canDeactivateTeam',
487
- * useValue: (component: TeamComponent, currentRoute: ActivatedRouteSnapshot, currentState:
488
- * RouterStateSnapshot, nextState: RouterStateSnapshot) => true
489
- * }
490
- * ]
491
495
  * })
492
496
  * class AppModule {}
493
497
  * ```
@@ -498,6 +502,15 @@ export declare interface CanDeactivate<T> {
498
502
  canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
499
503
  }
500
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
+
501
514
  /**
502
515
  * @description
503
516
  *
@@ -549,7 +562,7 @@ export declare interface CanDeactivate<T> {
549
562
  * class AppModule {}
550
563
  * ```
551
564
  *
552
- * You can alternatively provide an in-line function with the `canLoad` signature:
565
+ * You can alternatively provide an in-line function with the `CanLoadFn` signature:
553
566
  *
554
567
  * ```
555
568
  * @NgModule({
@@ -559,16 +572,10 @@ export declare interface CanDeactivate<T> {
559
572
  * path: 'team/:id',
560
573
  * component: TeamComponent,
561
574
  * loadChildren: () => import('./team').then(mod => mod.TeamModule),
562
- * canLoad: ['canLoadTeamSection']
575
+ * canLoad: [(route: Route, segments: UrlSegment[]) => true]
563
576
  * }
564
577
  * ])
565
578
  * ],
566
- * providers: [
567
- * {
568
- * provide: 'canLoadTeamSection',
569
- * useValue: (route: Route, segments: UrlSegment[]) => true
570
- * }
571
- * ]
572
579
  * })
573
580
  * class AppModule {}
574
581
  * ```
@@ -579,6 +586,15 @@ export declare interface CanLoad {
579
586
  canLoad(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
580
587
  }
581
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
+
582
598
  /**
583
599
  * @description
584
600
  *
@@ -638,11 +654,9 @@ export declare interface CanLoad {
638
654
  * `team/:id` URL, but would load the `NotFoundComponent` because the `Route` for `'team/:id'`
639
655
  * could not be used for a URL match but the catch-all `**` `Route` did instead.
640
656
  *
641
- * You can alternatively provide an in-line function with the `canMatch` signature:
657
+ * You can alternatively provide an in-line function with the `CanMatchFn` signature:
642
658
  *
643
659
  * ```
644
- * const CAN_MATCH_TEAM_SECTION = new InjectionToken('CanMatchTeamSection');
645
- *
646
660
  * @NgModule({
647
661
  * imports: [
648
662
  * RouterModule.forRoot([
@@ -650,7 +664,7 @@ export declare interface CanLoad {
650
664
  * path: 'team/:id',
651
665
  * component: TeamComponent,
652
666
  * loadChildren: () => import('./team').then(mod => mod.TeamModule),
653
- * canMatch: [CAN_MATCH_TEAM_SECTION]
667
+ * canMatch: [(route: Route, segments: UrlSegment[]) => true]
654
668
  * },
655
669
  * {
656
670
  * path: '**',
@@ -658,12 +672,6 @@ export declare interface CanLoad {
658
672
  * }
659
673
  * ])
660
674
  * ],
661
- * providers: [
662
- * {
663
- * provide: CAN_MATCH_TEAM_SECTION,
664
- * useValue: (route: Route, segments: UrlSegment[]) => true
665
- * }
666
- * ]
667
675
  * })
668
676
  * class AppModule {}
669
677
  * ```
@@ -819,6 +827,17 @@ export declare type Data = {
819
827
  [key: string | symbol]: any;
820
828
  };
821
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
+
822
841
  /**
823
842
  * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
824
843
  */
@@ -835,6 +854,23 @@ export declare class DefaultTitleStrategy extends TitleStrategy {
835
854
  static ɵprov: i0.ɵɵInjectableDeclaration<DefaultTitleStrategy>;
836
855
  }
837
856
 
857
+ /**
858
+ * Matches the route configuration (`route`) against the actual URL (`segments`).
859
+ *
860
+ * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.
861
+ *
862
+ * @param segments The remaining unmatched segments in the current navigation
863
+ * @param segmentGroup The current segment group being matched
864
+ * @param route The `Route` to match against.
865
+ *
866
+ * @see UrlMatchResult
867
+ * @see Route
868
+ *
869
+ * @returns The resulting match information or `null` if the `route` should not match.
870
+ * @publicApi
871
+ */
872
+ export declare function defaultUrlMatcher(segments: UrlSegment[], segmentGroup: UrlSegmentGroup, route: Route): UrlMatchResult | null;
873
+
838
874
  /**
839
875
  * @description
840
876
  *
@@ -872,6 +908,30 @@ export declare class DefaultUrlSerializer implements UrlSerializer {
872
908
  */
873
909
  export declare type DetachedRouteHandle = {};
874
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
+
875
935
  /**
876
936
  * Error handler that is invoked when a navigation error occurs.
877
937
  *
@@ -952,7 +1012,7 @@ export declare const enum EventType {
952
1012
  *
953
1013
  * @publicApi
954
1014
  */
955
- export declare interface ExtraOptions {
1015
+ export declare interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
956
1016
  /**
957
1017
  * When true, log all internal navigation events to the console.
958
1018
  * Use for debugging.
@@ -987,57 +1047,6 @@ export declare interface ExtraOptions {
987
1047
  * One of `PreloadAllModules` or `NoPreloading` (the default).
988
1048
  */
989
1049
  preloadingStrategy?: any;
990
- /**
991
- * Define what the router should do if it receives a navigation request to the current URL.
992
- * Default is `ignore`, which causes the router ignores the navigation.
993
- * This can disable features such as a "refresh" button.
994
- * Use this option to configure the behavior when navigating to the
995
- * current URL. Default is 'ignore'.
996
- */
997
- onSameUrlNavigation?: 'reload' | 'ignore';
998
- /**
999
- * Configures if the scroll position needs to be restored when navigating back.
1000
- *
1001
- * * 'disabled'- (Default) Does nothing. Scroll position is maintained on navigation.
1002
- * * 'top'- Sets the scroll position to x = 0, y = 0 on all navigation.
1003
- * * 'enabled'- Restores the previous scroll position on backward navigation, else sets the
1004
- * position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
1005
- * navigation). This option will be the default in the future.
1006
- *
1007
- * You can implement custom scroll restoration behavior by adapting the enabled behavior as
1008
- * in the following example.
1009
- *
1010
- * ```typescript
1011
- * class AppComponent {
1012
- * movieData: any;
1013
- *
1014
- * constructor(private router: Router, private viewportScroller: ViewportScroller,
1015
- * changeDetectorRef: ChangeDetectorRef) {
1016
- * router.events.pipe(filter((event: Event): event is Scroll => event instanceof Scroll)
1017
- * ).subscribe(e => {
1018
- * fetch('http://example.com/movies.json').then(response => {
1019
- * this.movieData = response.json();
1020
- * // update the template with the data before restoring scroll
1021
- * changeDetectorRef.detectChanges();
1022
- *
1023
- * if (e.position) {
1024
- * viewportScroller.scrollToPosition(e.position);
1025
- * }
1026
- * });
1027
- * });
1028
- * }
1029
- * }
1030
- * ```
1031
- */
1032
- scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
1033
- /**
1034
- * When set to 'enabled', scrolls to the anchor element when the URL has a fragment.
1035
- * Anchor scrolling is disabled by default.
1036
- *
1037
- * Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
1038
- * that we stored or scroll to the top.
1039
- */
1040
- anchorScrolling?: 'disabled' | 'enabled';
1041
1050
  /**
1042
1051
  * Configures the scroll offset the router will use when scrolling to an element.
1043
1052
  *
@@ -1047,21 +1056,6 @@ export declare interface ExtraOptions {
1047
1056
  * it restores scroll position.
1048
1057
  */
1049
1058
  scrollOffset?: [number, number] | (() => [number, number]);
1050
- /**
1051
- * Defines how the router merges parameters, data, and resolved data from parent to child
1052
- * routes. By default ('emptyOnly'), inherits parent parameters only for
1053
- * path-less or component-less routes.
1054
- *
1055
- * Set to 'always' to enable unconditional inheritance of parent parameters.
1056
- *
1057
- * Note that when dealing with matrix parameters, "parent" refers to the parent `Route`
1058
- * config which does not necessarily mean the "URL segment to the left". When the `Route` `path`
1059
- * contains multiple segments, the matrix parameters must appear on the last segment. For example,
1060
- * matrix parameters for `{path: 'a/b', component: MyComp}` should appear as `a/b;foo=bar` and not
1061
- * `a;foo=bar/b`.
1062
- *
1063
- */
1064
- paramsInheritanceStrategy?: 'emptyOnly' | 'always';
1065
1059
  /**
1066
1060
  * A custom handler for malformed URI errors. The handler is invoked when `encodedURI` contains
1067
1061
  * invalid character sequences.
@@ -1073,14 +1067,6 @@ export declare interface ExtraOptions {
1073
1067
  * - `'url'` - The malformed URL that caused the URIError
1074
1068
  * */
1075
1069
  malformedUriErrorHandler?: (error: URIError, urlSerializer: UrlSerializer, url: string) => UrlTree;
1076
- /**
1077
- * Defines when the router updates the browser URL. By default ('deferred'),
1078
- * update after successful navigation.
1079
- * Set to 'eager' if prefer to update the URL at the beginning of navigation.
1080
- * Updating the URL early allows you to handle a failure of navigation by
1081
- * showing an error message with the URL that failed.
1082
- */
1083
- urlUpdateStrategy?: 'deferred' | 'eager';
1084
1070
  /**
1085
1071
  * Enables a bug fix that corrects relative link resolution in components with empty paths.
1086
1072
  * Example:
@@ -1116,28 +1102,6 @@ export declare interface ExtraOptions {
1116
1102
  * @deprecated
1117
1103
  */
1118
1104
  relativeLinkResolution?: 'legacy' | 'corrected';
1119
- /**
1120
- * Configures how the Router attempts to restore state when a navigation is cancelled.
1121
- *
1122
- * 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
1123
- * router before the navigation started. This means that if the URL of the browser is updated
1124
- * _before_ the navigation is canceled, the Router will simply replace the item in history rather
1125
- * than trying to restore to the previous location in the session history. This happens most
1126
- * frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
1127
- * buttons.
1128
- *
1129
- * 'computed' - Will attempt to return to the same index in the session history that corresponds
1130
- * to the Angular route when the navigation gets cancelled. For example, if the browser back
1131
- * button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
1132
- * and vice versa.
1133
- *
1134
- * Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
1135
- * handles a portion of the URL because the history restoration navigates to the previous place in
1136
- * the browser history rather than simply resetting a portion of the URL.
1137
- *
1138
- * The default value is `replace` when not set.
1139
- */
1140
- canceledNavigationResolution?: 'replace' | 'computed';
1141
1105
  }
1142
1106
 
1143
1107
  /**
@@ -1242,6 +1206,83 @@ declare namespace i4 {
1242
1206
  */
1243
1207
  export declare type InitialNavigation = 'disabled' | 'enabledBlocking' | 'enabledNonBlocking';
1244
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
+
1245
1286
  /**
1246
1287
  * A set of options which specify how to determine if a `UrlTree` is active, given the `UrlTree`
1247
1288
  * for the current router state.
@@ -1762,6 +1803,18 @@ export declare class PreloadAllModules implements PreloadingStrategy {
1762
1803
  static ɵprov: i0.ɵɵInjectableDeclaration<PreloadAllModules>;
1763
1804
  }
1764
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
+
1765
1818
  /**
1766
1819
  * @description
1767
1820
  *
@@ -1780,6 +1833,45 @@ export declare abstract class PreloadingStrategy {
1780
1833
  */
1781
1834
  export declare const PRIMARY_OUTLET = "primary";
1782
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
+
1783
1875
  /**
1784
1876
  * Registers a [DI provider](guide/glossary#provider) for a set of routes.
1785
1877
  * @param routes The route configuration to provide.
@@ -1788,10 +1880,9 @@ export declare const PRIMARY_OUTLET = "primary";
1788
1880
  *
1789
1881
  * ```
1790
1882
  * @NgModule({
1791
- * imports: [RouterModule.forChild(ROUTES)],
1792
- * providers: [provideRoutes(EXTRA_ROUTES)]
1883
+ * providers: [provideRoutes(ROUTES)]
1793
1884
  * })
1794
- * class MyNgModule {}
1885
+ * class LazyLoadedChildModule {}
1795
1886
  * ```
1796
1887
  *
1797
1888
  * @publicApi
@@ -1859,7 +1950,7 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
1859
1950
  * export class AppRoutingModule {}
1860
1951
  * ```
1861
1952
  *
1862
- * You can alternatively provide an in-line function with the `resolve()` signature:
1953
+ * You can alternatively provide an in-line function with the `ResolveFn` signature:
1863
1954
  *
1864
1955
  * ```
1865
1956
  * export const myHero: Hero = {
@@ -1873,17 +1964,11 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
1873
1964
  * path: 'detail/:id',
1874
1965
  * component: HeroComponent,
1875
1966
  * resolve: {
1876
- * hero: 'heroResolver'
1967
+ * hero: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => myHero
1877
1968
  * }
1878
1969
  * }
1879
1970
  * ])
1880
1971
  * ],
1881
- * providers: [
1882
- * {
1883
- * provide: 'heroResolver',
1884
- * useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => myHero
1885
- * }
1886
- * ]
1887
1972
  * })
1888
1973
  * export class AppModule {}
1889
1974
  * ```
@@ -1946,7 +2031,7 @@ export declare interface Resolve<T> {
1946
2031
  * @publicApi
1947
2032
  */
1948
2033
  export declare type ResolveData = {
1949
- [key: string | symbol]: any;
2034
+ [key: string | symbol]: any | ResolveFn<unknown>;
1950
2035
  };
1951
2036
 
1952
2037
  /**
@@ -1973,6 +2058,14 @@ export declare class ResolveEnd extends RouterEvent {
1973
2058
  toString(): string;
1974
2059
  }
1975
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
+
1976
2069
  /**
1977
2070
  * An event triggered at the start of the Resolve phase of routing.
1978
2071
  *
@@ -2233,7 +2326,7 @@ export declare interface Route {
2233
2326
  *
2234
2327
  * @see `PageTitleStrategy`
2235
2328
  */
2236
- title?: string | Type<Resolve<string>>;
2329
+ title?: string | Type<Resolve<string>> | ResolveFn<string>;
2237
2330
  /**
2238
2331
  * The path to match against. Cannot be used together with a custom `matcher` function.
2239
2332
  * A URL string that uses router matching notation.
@@ -2290,36 +2383,50 @@ export declare interface Route {
2290
2383
  */
2291
2384
  outlet?: string;
2292
2385
  /**
2293
- * An array of dependency-injection tokens used to look up `CanActivate()`
2386
+ * An array of `CanActivateFn` or DI tokens used to look up `CanActivate()`
2294
2387
  * handlers, in order to determine if the current user is allowed to
2295
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.
2296
2392
  */
2297
- canActivate?: any[];
2393
+ canActivate?: Array<CanActivateFn | any>;
2298
2394
  /**
2299
- * An array of DI tokens used to look up `CanMatch()`
2395
+ * An array of `CanMatchFn` or DI tokens used to look up `CanMatch()`
2300
2396
  * handlers, in order to determine if the current user is allowed to
2301
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.
2302
2401
  */
2303
- canMatch?: Array<Type<CanMatch> | InjectionToken<CanMatchFn>>;
2402
+ canMatch?: Array<Type<CanMatch> | InjectionToken<CanMatchFn> | CanMatchFn>;
2304
2403
  /**
2305
- * 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,
2306
2405
  * in order to determine if the current user is allowed to activate
2307
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.
2308
2410
  */
2309
- canActivateChild?: any[];
2411
+ canActivateChild?: Array<CanActivateChildFn | any>;
2310
2412
  /**
2311
- * An array of DI tokens used to look up `CanDeactivate()`
2413
+ * An array of `CanDeactivateFn` or DI tokens used to look up `CanDeactivate()`
2312
2414
  * handlers, in order to determine if the current user is allowed to
2313
2415
  * deactivate the component. By default, any user can deactivate.
2314
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.
2315
2419
  */
2316
- canDeactivate?: any[];
2420
+ canDeactivate?: Array<CanDeactivateFn<any> | any>;
2317
2421
  /**
2318
- * An array of DI tokens used to look up `CanLoad()`
2422
+ * An array of `CanLoadFn` or DI tokens used to look up `CanLoad()`
2319
2423
  * handlers, in order to determine if the current user is allowed to
2320
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.
2321
2428
  */
2322
- canLoad?: any[];
2429
+ canLoad?: Array<CanLoadFn | any>;
2323
2430
  /**
2324
2431
  * Additional developer-defined data provided to the component via
2325
2432
  * `ActivatedRoute`. By default, no additional data is passed.
@@ -2790,6 +2897,79 @@ declare class RouterConfigLoader {
2790
2897
  static ɵprov: i0.ɵɵInjectableDeclaration<RouterConfigLoader>;
2791
2898
  }
2792
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
+
2793
2973
  /**
2794
2974
  * @description
2795
2975
  *
@@ -2850,6 +3030,42 @@ export declare class RouterEvent {
2850
3030
  url: string);
2851
3031
  }
2852
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
+
2853
3069
  /**
2854
3070
  * @description
2855
3071
  *
@@ -2953,6 +3169,9 @@ export declare class RouterLink implements OnChanges {
2953
3169
  private readonly tabIndexAttribute;
2954
3170
  private readonly renderer;
2955
3171
  private readonly el;
3172
+ private _preserveFragment;
3173
+ private _skipLocationChange;
3174
+ private _replaceUrl;
2956
3175
  /**
2957
3176
  * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
2958
3177
  * `UrlCreationOptions`.
@@ -2974,27 +3193,6 @@ export declare class RouterLink implements OnChanges {
2974
3193
  * @see {@link Router#createUrlTree Router#createUrlTree}
2975
3194
  */
2976
3195
  queryParamsHandling?: QueryParamsHandling | null;
2977
- /**
2978
- * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
2979
- * `UrlCreationOptions`.
2980
- * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
2981
- * @see {@link Router#createUrlTree Router#createUrlTree}
2982
- */
2983
- preserveFragment: boolean;
2984
- /**
2985
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
2986
- * `NavigationBehaviorOptions`.
2987
- * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
2988
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
2989
- */
2990
- skipLocationChange: boolean;
2991
- /**
2992
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
2993
- * `NavigationBehaviorOptions`.
2994
- * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
2995
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
2996
- */
2997
- replaceUrl: boolean;
2998
3196
  /**
2999
3197
  * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3000
3198
  * `NavigationBehaviorOptions`.
@@ -3016,6 +3214,30 @@ export declare class RouterLink implements OnChanges {
3016
3214
  relativeTo?: ActivatedRoute | null;
3017
3215
  private commands;
3018
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;
3019
3241
  /**
3020
3242
  * Modifies the tab index if there was not a tabindex attribute on the element during
3021
3243
  * instantiation.
@@ -3035,7 +3257,7 @@ export declare class RouterLink implements OnChanges {
3035
3257
  onClick(): boolean;
3036
3258
  get urlTree(): UrlTree | null;
3037
3259
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLink, [null, null, { attribute: "tabindex"; }, null, null]>;
3038
- 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>;
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>;
3039
3261
  }
3040
3262
 
3041
3263
  /**
@@ -3168,7 +3390,7 @@ export declare class RouterLinkActive implements OnChanges, OnDestroy, AfterCont
3168
3390
  private isLinkActive;
3169
3391
  private hasActiveLinks;
3170
3392
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkActive, [null, null, null, null, { optional: true; }, { optional: true; }]>;
3171
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkActive, "[routerLinkActive]", ["routerLinkActive"], { "routerLinkActiveOptions": "routerLinkActiveOptions"; "ariaCurrentWhenActive": "ariaCurrentWhenActive"; "routerLinkActive": "routerLinkActive"; }, { "isActiveChange": "isActiveChange"; }, ["links", "linksWithHrefs"], never, false>;
3393
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkActive, "[routerLinkActive]", ["routerLinkActive"], { "routerLinkActiveOptions": "routerLinkActiveOptions"; "ariaCurrentWhenActive": "ariaCurrentWhenActive"; "routerLinkActive": "routerLinkActive"; }, { "isActiveChange": "isActiveChange"; }, ["links", "linksWithHrefs"], never, true>;
3172
3394
  }
3173
3395
 
3174
3396
  /**
@@ -3186,6 +3408,9 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3186
3408
  private router;
3187
3409
  private route;
3188
3410
  private locationStrategy;
3411
+ private _preserveFragment;
3412
+ private _skipLocationChange;
3413
+ private _replaceUrl;
3189
3414
  target: string;
3190
3415
  /**
3191
3416
  * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
@@ -3208,27 +3433,6 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3208
3433
  * @see {@link Router#createUrlTree Router#createUrlTree}
3209
3434
  */
3210
3435
  queryParamsHandling?: QueryParamsHandling | null;
3211
- /**
3212
- * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
3213
- * `UrlCreationOptions`.
3214
- * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
3215
- * @see {@link Router#createUrlTree Router#createUrlTree}
3216
- */
3217
- preserveFragment: boolean;
3218
- /**
3219
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3220
- * `NavigationBehaviorOptions`.
3221
- * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
3222
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
3223
- */
3224
- skipLocationChange: boolean;
3225
- /**
3226
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3227
- * `NavigationBehaviorOptions`.
3228
- * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
3229
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
3230
- */
3231
- replaceUrl: boolean;
3232
3436
  /**
3233
3437
  * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3234
3438
  * `NavigationBehaviorOptions`.
@@ -3252,6 +3456,30 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3252
3456
  private subscription;
3253
3457
  href: string | null;
3254
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;
3255
3483
  /**
3256
3484
  * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
3257
3485
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
@@ -3269,7 +3497,7 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3269
3497
  private updateTargetUrlAndHref;
3270
3498
  get urlTree(): UrlTree | null;
3271
3499
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkWithHref, never>;
3272
- 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>;
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>;
3273
3501
  }
3274
3502
 
3275
3503
  /**
@@ -3332,7 +3560,7 @@ export declare class RouterModule {
3332
3560
  */
3333
3561
  static forChild(routes: Routes): ModuleWithProviders<RouterModule>;
3334
3562
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterModule, [{ optional: true; }]>;
3335
- 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]>;
3563
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, never, [typeof i1.RouterOutlet, typeof i2.RouterLink, typeof i2.RouterLinkWithHref, typeof i3.RouterLinkActive, typeof i4.ɵEmptyOutletComponent], [typeof i1.RouterOutlet, typeof i2.RouterLink, typeof i2.RouterLinkWithHref, typeof i3.RouterLinkActive, typeof i4.ɵEmptyOutletComponent]>;
3336
3564
  static ɵinj: i0.ɵɵInjectorDeclaration<RouterModule>;
3337
3565
  }
3338
3566
 
@@ -3431,7 +3659,7 @@ export declare class RouterOutlet implements OnDestroy, OnInit, RouterOutletCont
3431
3659
  deactivate(): void;
3432
3660
  activateWith(activatedRoute: ActivatedRoute, resolverOrInjector?: ComponentFactoryResolver | EnvironmentInjector | null): void;
3433
3661
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterOutlet, [null, null, { attribute: "name"; }, null, null]>;
3434
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterOutlet, "router-outlet", ["outlet"], {}, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; "attachEvents": "attach"; "detachEvents": "detach"; }, never, never, false>;
3662
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RouterOutlet, "router-outlet", ["outlet"], {}, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; "attachEvents": "attach"; "detachEvents": "detach"; }, never, never, true>;
3435
3663
  }
3436
3664
 
3437
3665
  /**
@@ -4073,6 +4301,179 @@ export declare class UrlTree {
4073
4301
  */
4074
4302
  export declare const VERSION: Version;
4075
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
+
4076
4477
  export declare function ɵassignExtraOptionsToRouter(opts: ExtraOptions, router: Router): void;
4077
4478
 
4078
4479
  /**
@@ -4086,7 +4487,7 @@ export declare function ɵassignExtraOptionsToRouter(opts: ExtraOptions, router:
4086
4487
  */
4087
4488
  export declare class ɵEmptyOutletComponent {
4088
4489
  static ɵfac: i0.ɵɵFactoryDeclaration<ɵEmptyOutletComponent, never>;
4089
- static ɵcmp: i0.ɵɵComponentDeclaration<ɵEmptyOutletComponent, "ng-component", never, {}, {}, never, never, false>;
4490
+ static ɵcmp: i0.ɵɵComponentDeclaration<ɵEmptyOutletComponent, "ng-component", never, {}, {}, never, never, true>;
4090
4491
  }
4091
4492
 
4092
4493
  /**
@@ -4094,8 +4495,6 @@ export declare class ɵEmptyOutletComponent {
4094
4495
  */
4095
4496
  export declare function ɵflatten<T>(arr: T[][]): T[];
4096
4497
 
4097
- export declare function ɵprovidePreloading(preloadingStrategy: Type<PreloadingStrategy>): Provider[];
4098
-
4099
4498
  export declare type ɵRestoredState = {
4100
4499
  [k: string]: any;
4101
4500
  navigationId: number;