@angular/router 14.2.0-next.1 → 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 (34) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/directives/router_link.mjs +101 -23
  3. package/esm2020/src/directives/router_link_active.mjs +3 -3
  4. package/esm2020/src/directives/router_outlet.mjs +3 -3
  5. package/esm2020/src/index.mjs +3 -2
  6. package/esm2020/src/page_title_strategy.mjs +6 -6
  7. package/esm2020/src/patchable_relative_link_resolution.mjs +12 -0
  8. package/esm2020/src/private_export.mjs +3 -2
  9. package/esm2020/src/provide_router.mjs +420 -0
  10. package/esm2020/src/router.mjs +6 -4
  11. package/esm2020/src/router_config.mjs +1 -1
  12. package/esm2020/src/router_config_loader.mjs +3 -3
  13. package/esm2020/src/router_module.mjs +28 -185
  14. package/esm2020/src/router_outlet_context.mjs +3 -3
  15. package/esm2020/src/router_preloader.mjs +12 -11
  16. package/esm2020/src/router_scroller.mjs +3 -3
  17. package/esm2020/src/url_tree.mjs +3 -3
  18. package/esm2020/src/version.mjs +1 -1
  19. package/esm2020/testing/src/provide_router_for_testing.mjs +51 -0
  20. package/esm2020/testing/src/router_testing_module.mjs +8 -8
  21. package/fesm2015/router.mjs +626 -279
  22. package/fesm2015/router.mjs.map +1 -1
  23. package/fesm2015/testing.mjs +8 -8
  24. package/fesm2015/testing.mjs.map +1 -1
  25. package/fesm2015/upgrade.mjs +1 -1
  26. package/fesm2020/router.mjs +624 -277
  27. package/fesm2020/router.mjs.map +1 -1
  28. package/fesm2020/testing.mjs +8 -8
  29. package/fesm2020/testing.mjs.map +1 -1
  30. package/fesm2020/upgrade.mjs +1 -1
  31. package/index.d.ts +505 -147
  32. package/package.json +4 -4
  33. package/testing/index.d.ts +1 -1
  34. package/upgrade/index.d.ts +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.2.0-next.1
2
+ * @license Angular v14.2.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -827,6 +827,17 @@ export declare type Data = {
827
827
  [key: string | symbol]: any;
828
828
  };
829
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
+
830
841
  /**
831
842
  * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
832
843
  */
@@ -897,6 +908,30 @@ export declare class DefaultUrlSerializer implements UrlSerializer {
897
908
  */
898
909
  export declare type DetachedRouteHandle = {};
899
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
+
900
935
  /**
901
936
  * Error handler that is invoked when a navigation error occurs.
902
937
  *
@@ -977,7 +1012,7 @@ export declare const enum EventType {
977
1012
  *
978
1013
  * @publicApi
979
1014
  */
980
- export declare interface ExtraOptions {
1015
+ export declare interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
981
1016
  /**
982
1017
  * When true, log all internal navigation events to the console.
983
1018
  * Use for debugging.
@@ -1012,57 +1047,6 @@ export declare interface ExtraOptions {
1012
1047
  * One of `PreloadAllModules` or `NoPreloading` (the default).
1013
1048
  */
1014
1049
  preloadingStrategy?: any;
1015
- /**
1016
- * Define what the router should do if it receives a navigation request to the current URL.
1017
- * Default is `ignore`, which causes the router ignores the navigation.
1018
- * This can disable features such as a "refresh" button.
1019
- * Use this option to configure the behavior when navigating to the
1020
- * current URL. Default is 'ignore'.
1021
- */
1022
- onSameUrlNavigation?: 'reload' | 'ignore';
1023
- /**
1024
- * Configures if the scroll position needs to be restored when navigating back.
1025
- *
1026
- * * 'disabled'- (Default) Does nothing. Scroll position is maintained on navigation.
1027
- * * 'top'- Sets the scroll position to x = 0, y = 0 on all navigation.
1028
- * * 'enabled'- Restores the previous scroll position on backward navigation, else sets the
1029
- * position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
1030
- * navigation). This option will be the default in the future.
1031
- *
1032
- * You can implement custom scroll restoration behavior by adapting the enabled behavior as
1033
- * in the following example.
1034
- *
1035
- * ```typescript
1036
- * class AppComponent {
1037
- * movieData: any;
1038
- *
1039
- * constructor(private router: Router, private viewportScroller: ViewportScroller,
1040
- * changeDetectorRef: ChangeDetectorRef) {
1041
- * router.events.pipe(filter((event: Event): event is Scroll => event instanceof Scroll)
1042
- * ).subscribe(e => {
1043
- * fetch('http://example.com/movies.json').then(response => {
1044
- * this.movieData = response.json();
1045
- * // update the template with the data before restoring scroll
1046
- * changeDetectorRef.detectChanges();
1047
- *
1048
- * if (e.position) {
1049
- * viewportScroller.scrollToPosition(e.position);
1050
- * }
1051
- * });
1052
- * });
1053
- * }
1054
- * }
1055
- * ```
1056
- */
1057
- scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
1058
- /**
1059
- * When set to 'enabled', scrolls to the anchor element when the URL has a fragment.
1060
- * Anchor scrolling is disabled by default.
1061
- *
1062
- * Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
1063
- * that we stored or scroll to the top.
1064
- */
1065
- anchorScrolling?: 'disabled' | 'enabled';
1066
1050
  /**
1067
1051
  * Configures the scroll offset the router will use when scrolling to an element.
1068
1052
  *
@@ -1072,21 +1056,6 @@ export declare interface ExtraOptions {
1072
1056
  * it restores scroll position.
1073
1057
  */
1074
1058
  scrollOffset?: [number, number] | (() => [number, number]);
1075
- /**
1076
- * Defines how the router merges parameters, data, and resolved data from parent to child
1077
- * routes. By default ('emptyOnly'), inherits parent parameters only for
1078
- * path-less or component-less routes.
1079
- *
1080
- * Set to 'always' to enable unconditional inheritance of parent parameters.
1081
- *
1082
- * Note that when dealing with matrix parameters, "parent" refers to the parent `Route`
1083
- * config which does not necessarily mean the "URL segment to the left". When the `Route` `path`
1084
- * contains multiple segments, the matrix parameters must appear on the last segment. For example,
1085
- * matrix parameters for `{path: 'a/b', component: MyComp}` should appear as `a/b;foo=bar` and not
1086
- * `a;foo=bar/b`.
1087
- *
1088
- */
1089
- paramsInheritanceStrategy?: 'emptyOnly' | 'always';
1090
1059
  /**
1091
1060
  * A custom handler for malformed URI errors. The handler is invoked when `encodedURI` contains
1092
1061
  * invalid character sequences.
@@ -1098,14 +1067,6 @@ export declare interface ExtraOptions {
1098
1067
  * - `'url'` - The malformed URL that caused the URIError
1099
1068
  * */
1100
1069
  malformedUriErrorHandler?: (error: URIError, urlSerializer: UrlSerializer, url: string) => UrlTree;
1101
- /**
1102
- * Defines when the router updates the browser URL. By default ('deferred'),
1103
- * update after successful navigation.
1104
- * Set to 'eager' if prefer to update the URL at the beginning of navigation.
1105
- * Updating the URL early allows you to handle a failure of navigation by
1106
- * showing an error message with the URL that failed.
1107
- */
1108
- urlUpdateStrategy?: 'deferred' | 'eager';
1109
1070
  /**
1110
1071
  * Enables a bug fix that corrects relative link resolution in components with empty paths.
1111
1072
  * Example:
@@ -1141,28 +1102,6 @@ export declare interface ExtraOptions {
1141
1102
  * @deprecated
1142
1103
  */
1143
1104
  relativeLinkResolution?: 'legacy' | 'corrected';
1144
- /**
1145
- * Configures how the Router attempts to restore state when a navigation is cancelled.
1146
- *
1147
- * 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
1148
- * router before the navigation started. This means that if the URL of the browser is updated
1149
- * _before_ the navigation is canceled, the Router will simply replace the item in history rather
1150
- * than trying to restore to the previous location in the session history. This happens most
1151
- * frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
1152
- * buttons.
1153
- *
1154
- * 'computed' - Will attempt to return to the same index in the session history that corresponds
1155
- * to the Angular route when the navigation gets cancelled. For example, if the browser back
1156
- * button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
1157
- * and vice versa.
1158
- *
1159
- * Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
1160
- * handles a portion of the URL because the history restoration navigates to the previous place in
1161
- * the browser history rather than simply resetting a portion of the URL.
1162
- *
1163
- * The default value is `replace` when not set.
1164
- */
1165
- canceledNavigationResolution?: 'replace' | 'computed';
1166
1105
  }
1167
1106
 
1168
1107
  /**
@@ -1267,6 +1206,83 @@ declare namespace i4 {
1267
1206
  */
1268
1207
  export declare type InitialNavigation = 'disabled' | 'enabledBlocking' | 'enabledNonBlocking';
1269
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
+
1270
1286
  /**
1271
1287
  * A set of options which specify how to determine if a `UrlTree` is active, given the `UrlTree`
1272
1288
  * for the current router state.
@@ -1787,6 +1803,18 @@ export declare class PreloadAllModules implements PreloadingStrategy {
1787
1803
  static ɵprov: i0.ɵɵInjectableDeclaration<PreloadAllModules>;
1788
1804
  }
1789
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
+
1790
1818
  /**
1791
1819
  * @description
1792
1820
  *
@@ -1805,6 +1833,45 @@ export declare abstract class PreloadingStrategy {
1805
1833
  */
1806
1834
  export declare const PRIMARY_OUTLET = "primary";
1807
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
+
1808
1875
  /**
1809
1876
  * Registers a [DI provider](guide/glossary#provider) for a set of routes.
1810
1877
  * @param routes The route configuration to provide.
@@ -1813,10 +1880,9 @@ export declare const PRIMARY_OUTLET = "primary";
1813
1880
  *
1814
1881
  * ```
1815
1882
  * @NgModule({
1816
- * imports: [RouterModule.forChild(ROUTES)],
1817
- * providers: [provideRoutes(EXTRA_ROUTES)]
1883
+ * providers: [provideRoutes(ROUTES)]
1818
1884
  * })
1819
- * class MyNgModule {}
1885
+ * class LazyLoadedChildModule {}
1820
1886
  * ```
1821
1887
  *
1822
1888
  * @publicApi
@@ -2831,6 +2897,79 @@ declare class RouterConfigLoader {
2831
2897
  static ɵprov: i0.ɵɵInjectableDeclaration<RouterConfigLoader>;
2832
2898
  }
2833
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
+
2834
2973
  /**
2835
2974
  * @description
2836
2975
  *
@@ -2891,6 +3030,42 @@ export declare class RouterEvent {
2891
3030
  url: string);
2892
3031
  }
2893
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
+
2894
3069
  /**
2895
3070
  * @description
2896
3071
  *
@@ -2994,6 +3169,9 @@ export declare class RouterLink implements OnChanges {
2994
3169
  private readonly tabIndexAttribute;
2995
3170
  private readonly renderer;
2996
3171
  private readonly el;
3172
+ private _preserveFragment;
3173
+ private _skipLocationChange;
3174
+ private _replaceUrl;
2997
3175
  /**
2998
3176
  * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
2999
3177
  * `UrlCreationOptions`.
@@ -3015,27 +3193,6 @@ export declare class RouterLink implements OnChanges {
3015
3193
  * @see {@link Router#createUrlTree Router#createUrlTree}
3016
3194
  */
3017
3195
  queryParamsHandling?: QueryParamsHandling | null;
3018
- /**
3019
- * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
3020
- * `UrlCreationOptions`.
3021
- * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
3022
- * @see {@link Router#createUrlTree Router#createUrlTree}
3023
- */
3024
- preserveFragment: boolean;
3025
- /**
3026
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3027
- * `NavigationBehaviorOptions`.
3028
- * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
3029
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
3030
- */
3031
- skipLocationChange: boolean;
3032
- /**
3033
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3034
- * `NavigationBehaviorOptions`.
3035
- * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
3036
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
3037
- */
3038
- replaceUrl: boolean;
3039
3196
  /**
3040
3197
  * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3041
3198
  * `NavigationBehaviorOptions`.
@@ -3057,6 +3214,30 @@ export declare class RouterLink implements OnChanges {
3057
3214
  relativeTo?: ActivatedRoute | null;
3058
3215
  private commands;
3059
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;
3060
3241
  /**
3061
3242
  * Modifies the tab index if there was not a tabindex attribute on the element during
3062
3243
  * instantiation.
@@ -3076,7 +3257,7 @@ export declare class RouterLink implements OnChanges {
3076
3257
  onClick(): boolean;
3077
3258
  get urlTree(): UrlTree | null;
3078
3259
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLink, [null, null, { attribute: "tabindex"; }, null, null]>;
3079
- 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, true>;
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>;
3080
3261
  }
3081
3262
 
3082
3263
  /**
@@ -3227,6 +3408,9 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3227
3408
  private router;
3228
3409
  private route;
3229
3410
  private locationStrategy;
3411
+ private _preserveFragment;
3412
+ private _skipLocationChange;
3413
+ private _replaceUrl;
3230
3414
  target: string;
3231
3415
  /**
3232
3416
  * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
@@ -3249,27 +3433,6 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3249
3433
  * @see {@link Router#createUrlTree Router#createUrlTree}
3250
3434
  */
3251
3435
  queryParamsHandling?: QueryParamsHandling | null;
3252
- /**
3253
- * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
3254
- * `UrlCreationOptions`.
3255
- * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
3256
- * @see {@link Router#createUrlTree Router#createUrlTree}
3257
- */
3258
- preserveFragment: boolean;
3259
- /**
3260
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3261
- * `NavigationBehaviorOptions`.
3262
- * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
3263
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
3264
- */
3265
- skipLocationChange: boolean;
3266
- /**
3267
- * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3268
- * `NavigationBehaviorOptions`.
3269
- * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
3270
- * @see {@link Router#navigateByUrl Router#navigateByUrl}
3271
- */
3272
- replaceUrl: boolean;
3273
3436
  /**
3274
3437
  * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
3275
3438
  * `NavigationBehaviorOptions`.
@@ -3293,6 +3456,30 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3293
3456
  private subscription;
3294
3457
  href: string | null;
3295
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;
3296
3483
  /**
3297
3484
  * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
3298
3485
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
@@ -3310,7 +3497,7 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
3310
3497
  private updateTargetUrlAndHref;
3311
3498
  get urlTree(): UrlTree | null;
3312
3499
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkWithHref, never>;
3313
- 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, true>;
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>;
3314
3501
  }
3315
3502
 
3316
3503
  /**
@@ -4114,6 +4301,179 @@ export declare class UrlTree {
4114
4301
  */
4115
4302
  export declare const VERSION: Version;
4116
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
+
4117
4477
  export declare function ɵassignExtraOptionsToRouter(opts: ExtraOptions, router: Router): void;
4118
4478
 
4119
4479
  /**
@@ -4135,8 +4495,6 @@ export declare class ɵEmptyOutletComponent {
4135
4495
  */
4136
4496
  export declare function ɵflatten<T>(arr: T[][]): T[];
4137
4497
 
4138
- export declare function ɵprovidePreloading(preloadingStrategy: Type<PreloadingStrategy>): Provider[];
4139
-
4140
4498
  export declare type ɵRestoredState = {
4141
4499
  [k: string]: any;
4142
4500
  navigationId: number;