@angular/router 22.0.0-next.1 → 22.0.0-next.11

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v22.0.0-next.1
2
+ * @license Angular v22.0.0-next.11
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { InjectionToken, Signal, EnvironmentInjector, ComponentRef, EventEmitter, OnDestroy, OnInit, SimpleChanges, ProviderToken, Type, NgModuleFactory, Provider, EnvironmentProviders, OnChanges, Renderer2, ElementRef, AfterContentInit, QueryList, ChangeDetectorRef, ModuleWithProviders } from '@angular/core';
8
+ import { InjectionToken, EnvironmentInjector, ComponentRef, EventEmitter, Signal, OnDestroy, OnInit, SimpleChanges, Type, DefaultExport, ProviderToken, NgModuleFactory, Provider, EnvironmentProviders, OnChanges, Renderer2, ElementRef, AfterContentInit, QueryList, ChangeDetectorRef, ModuleWithProviders } from '@angular/core';
9
9
  import { Observable } from 'rxjs';
10
10
  import { LocationStrategy } from '@angular/common';
11
11
 
@@ -695,6 +695,284 @@ declare function convertToParamMap(params: Params): ParamMap;
695
695
  */
696
696
  declare function defaultUrlMatcher(segments: UrlSegment[], segmentGroup: UrlSegmentGroup, route: Route): UrlMatchResult | null;
697
697
 
698
+ /**
699
+ * Allowed values in an `ExtraOptions` object that configure
700
+ * when the router performs the initial navigation operation.
701
+ *
702
+ * * 'enabledNonBlocking' - (default) The initial navigation starts after the
703
+ * root component has been created. The bootstrap is not blocked on the completion of the initial
704
+ * navigation.
705
+ * * 'enabledBlocking' - The initial navigation starts before the root component is created.
706
+ * The bootstrap is blocked until the initial navigation is complete. This value should be set in
707
+ * case you use [server-side rendering](guide/ssr), but do not enable [hydration](guide/hydration)
708
+ * for your application.
709
+ * * 'disabled' - The initial navigation is not performed. The location listener is set up before
710
+ * the root component gets created. Use if there is a reason to have
711
+ * more control over when the router starts its initial navigation due to some complex
712
+ * initialization logic.
713
+ *
714
+ * @see {@link /api/router/RouterModule#forRoot forRoot}
715
+ *
716
+ * @publicApi
717
+ */
718
+ type InitialNavigation = 'disabled' | 'enabledBlocking' | 'enabledNonBlocking';
719
+ /**
720
+ * Extra configuration options that can be used with the `withRouterConfig` function.
721
+ *
722
+ * @see [Router configuration options](guide/routing/customizing-route-behavior#router-configuration-options)
723
+ *
724
+ * @publicApi
725
+ */
726
+ interface RouterConfigOptions {
727
+ /**
728
+ * Configures how the Router attempts to restore state when a navigation is cancelled.
729
+ *
730
+ * 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
731
+ * router before the navigation started. This means that if the URL of the browser is updated
732
+ * _before_ the navigation is canceled, the Router will simply replace the item in history rather
733
+ * than trying to restore to the previous location in the session history. This happens most
734
+ * frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
735
+ * buttons.
736
+ *
737
+ * 'computed' - Will attempt to return to the same index in the session history that corresponds
738
+ * to the Angular route when the navigation gets cancelled. For example, if the browser back
739
+ * button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
740
+ * and vice versa.
741
+ *
742
+ * Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
743
+ * handles a portion of the URL because the history restoration navigates to the previous place in
744
+ * the browser history rather than simply resetting a portion of the URL.
745
+ *
746
+ * The default value is `replace` when not set.
747
+ *
748
+ * @see [Handle canceled navigations](guide/routing/customizing-route-behavior#handle-canceled-navigations)
749
+ *
750
+ */
751
+ canceledNavigationResolution?: 'replace' | 'computed';
752
+ /**
753
+ * Configures the default for handling a navigation request to the current URL.
754
+ *
755
+ * If unset, the `Router` will use `'ignore'`.
756
+ *
757
+ * @see {@link OnSameUrlNavigation}
758
+ *
759
+ * @see [React to same-URL navigations](guide/routing/customizing-route-behavior#react-to-same-url-navigations)
760
+ */
761
+ onSameUrlNavigation?: OnSameUrlNavigation;
762
+ /**
763
+ * Defines how the router merges parameters, data, and resolved data from parent to child
764
+ * routes.
765
+ *
766
+ * By default ('always'), a route inherits all parameters from its parent routes.
767
+ *
768
+ * Set to 'emptyOnly' to preserve the legacy behavior where a route only inherits the parent
769
+ * route's parameters when the route itself has an empty path or when the parent route doesn't
770
+ * have any component set.
771
+ *
772
+ * Note that when dealing with matrix parameters, "parent" refers to the parent `Route`
773
+ * config which does not necessarily mean the "URL segment to the left". When the `Route` `path`
774
+ * contains multiple segments, the matrix parameters must appear on the last segment. For example,
775
+ * matrix parameters for `{path: 'a/b', component: MyComp}` should appear as `a/b;foo=bar` and not
776
+ * `a;foo=bar/b`.
777
+ *
778
+ * @see [Control parameter inheritance](guide/routing/customizing-route-behavior#control-parameter-inheritance)
779
+ *
780
+ */
781
+ paramsInheritanceStrategy?: 'emptyOnly' | 'always';
782
+ /**
783
+ * Defines when the router updates the browser URL. By default ('deferred'),
784
+ * update after successful navigation.
785
+ * Set to 'eager' if prefer to update the URL at the beginning of navigation.
786
+ * Updating the URL early allows you to handle a failure of navigation by
787
+ * showing an error message with the URL that failed.
788
+ *
789
+ * @see [Decide when the URL updates](guide/routing/customizing-route-behavior#decide-when-the-url-updates)
790
+ *
791
+ */
792
+ urlUpdateStrategy?: 'deferred' | 'eager';
793
+ /**
794
+ * The default strategy to use for handling query params in `Router.createUrlTree` when one is not provided.
795
+ *
796
+ * The `createUrlTree` method is used internally by `Router.navigate` and `RouterLink`.
797
+ * Note that `QueryParamsHandling` does not apply to `Router.navigateByUrl`.
798
+ *
799
+ * When neither the default nor the queryParamsHandling option is specified in the call to `createUrlTree`,
800
+ * the current parameters will be replaced by new parameters.
801
+ *
802
+ * @see {@link Router#createUrlTree}
803
+ * @see {@link QueryParamsHandling}
804
+ *
805
+ * @see [Choose default query parameter handling](guide/routing/customizing-route-behavior#choose-default-query-parameter-handling)
806
+
807
+ *
808
+ */
809
+ defaultQueryParamsHandling?: QueryParamsHandling;
810
+ /**
811
+ * When `true`, the `Promise` will instead resolve with `false`, as it does with other failed
812
+ * navigations (for example, when guards are rejected).
813
+
814
+ * Otherwise the `Promise` returned by the Router's navigation with be rejected
815
+ * if an error occurs.
816
+ */
817
+ resolveNavigationPromiseOnError?: boolean;
818
+ }
819
+ /**
820
+ * Configuration options for the scrolling feature which can be used with `withInMemoryScrolling`
821
+ * function or `RouterModule.forRoot`.
822
+ *
823
+ * @publicApi
824
+ * @see withInMemoryScrolling
825
+ * @see RouterModule#forRoot
826
+ */
827
+ interface InMemoryScrollingOptions {
828
+ /**
829
+ * When set to 'enabled', scrolls to the anchor element when the URL has a fragment.
830
+ * Anchor scrolling is disabled by default.
831
+ *
832
+ * Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
833
+ * that we stored or scroll to the top.
834
+ */
835
+ anchorScrolling?: 'disabled' | 'enabled';
836
+ /**
837
+ * Configures if the scroll position needs to be restored when navigating back.
838
+ *
839
+ * * 'disabled'- (Default) Does nothing. Scroll position is maintained on navigation.
840
+ * * 'top'- Sets the scroll position to x = 0, y = 0 on all navigation.
841
+ * * 'enabled'- Restores the previous scroll position on backward navigation, else sets the
842
+ * position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
843
+ * navigation). This option will be the default in the future.
844
+ *
845
+ * You can implement custom scroll restoration behavior by adapting the enabled behavior as
846
+ * in the following example.
847
+ *
848
+ * ```ts
849
+ * class AppComponent {
850
+ * movieData: any;
851
+ *
852
+ * constructor(private router: Router, private viewportScroller: ViewportScroller,
853
+ * changeDetectorRef: ChangeDetectorRef) {
854
+ * router.events.pipe(filter((event: Event): event is Scroll => event instanceof Scroll)
855
+ * ).subscribe(e => {
856
+ * fetch('http://example.com/movies.json').then(response => {
857
+ * this.movieData = response.json();
858
+ * // update the template with the data before restoring scroll
859
+ * changeDetectorRef.detectChanges();
860
+ *
861
+ * if (e.position) {
862
+ * viewportScroller.scrollToPosition(e.position);
863
+ * }
864
+ * });
865
+ * });
866
+ * }
867
+ * }
868
+ * ```
869
+ */
870
+ scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
871
+ }
872
+ /**
873
+ * Configuration options for the component input binding feature which can be used
874
+ * with `withComponentInputBinding` function or `RouterModule.forRoot`
875
+ *
876
+ * @publicApi
877
+ * @see withComponentInputBinding
878
+ * @see RouterModule#forRoot
879
+ * @see [Disable query parameter binding](guide/routing/common-router-tasks#disable-query-parameter-binding)
880
+ */
881
+ interface ComponentInputBindingOptions {
882
+ /**
883
+ * When true (default), will configure query parameters to bind to component
884
+ * inputs.
885
+ */
886
+ queryParams?: boolean;
887
+ /**
888
+ * Configures the behavior when an input is not matched by any key in the router data.
889
+ *
890
+ * - `'alwaysUndefined'`: (Default) Binds `undefined` to the input. This ensures that stale data
891
+ * is not retained.
892
+ * - `'undefinedIfStale'`: Binds `undefined` only if the input was previously available
893
+ * in the router data during the lifetime of the active route in this outlet. This avoids
894
+ * setting `undefined` for inputs that were never expected to be set by the router.
895
+ */
896
+ unmatchedInputBehavior?: 'alwaysUndefined' | 'undefinedIfStale';
897
+ }
898
+ /**
899
+ * A set of configuration options for a router module, provided in the
900
+ * `forRoot()` method.
901
+ *
902
+ * @see {@link /api/router/RouterModule#forRoot forRoot}
903
+ *
904
+ *
905
+ * @publicApi
906
+ */
907
+ interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
908
+ /**
909
+ * When true, log all internal navigation events to the console.
910
+ * Use for debugging.
911
+ */
912
+ enableTracing?: boolean;
913
+ /**
914
+ * When true, enable the location strategy that uses the URL fragment
915
+ * instead of the history API.
916
+ */
917
+ useHash?: boolean;
918
+ /**
919
+ * One of `enabled`, `enabledBlocking`, `enabledNonBlocking` or `disabled`.
920
+ * When set to `enabled` or `enabledBlocking`, the initial navigation starts before the root
921
+ * component is created. The bootstrap is blocked until the initial navigation is complete. This
922
+ * value should be set in case you use [server-side rendering](guide/ssr), but do not enable
923
+ * [hydration](guide/hydration) for your application. When set to `enabledNonBlocking`,
924
+ * the initial navigation starts after the root component has been created.
925
+ * The bootstrap is not blocked on the completion of the initial navigation. When set to
926
+ * `disabled`, the initial navigation is not performed. The location listener is set up before the
927
+ * root component gets created. Use if there is a reason to have more control over when the router
928
+ * starts its initial navigation due to some complex initialization logic.
929
+ */
930
+ initialNavigation?: InitialNavigation;
931
+ /**
932
+ * When true, enables binding information from the `Router` state directly to the inputs of the
933
+ * component in `Route` configurations. Can also accept an `ComponentInputBindingOptions` object
934
+ * to set whether to exclude queryParams from binding.
935
+ */
936
+ bindToComponentInputs?: boolean | ComponentInputBindingOptions;
937
+ /**
938
+ * When true, enables view transitions in the Router by running the route activation and
939
+ * deactivation inside of `document.startViewTransition`.
940
+ *
941
+ * @see https://developer.chrome.com/docs/web-platform/view-transitions/
942
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
943
+ * @experimental 17.0
944
+ */
945
+ enableViewTransitions?: boolean;
946
+ /**
947
+ * A custom error handler for failed navigations.
948
+ * If the handler returns a value, the navigation Promise is resolved with this value.
949
+ * If the handler throws an exception, the navigation Promise is rejected with the exception.
950
+ *
951
+ * @see RouterConfigOptions
952
+ */
953
+ errorHandler?: (error: any) => RedirectCommand | any;
954
+ /**
955
+ * Configures a preloading strategy.
956
+ * One of `PreloadAllModules` or `NoPreloading` (the default).
957
+ */
958
+ preloadingStrategy?: any;
959
+ /**
960
+ * Configures the scroll offset the router will use when scrolling to an element.
961
+ *
962
+ * When given a tuple with x and y position value,
963
+ * the router uses that offset each time it scrolls.
964
+ * When given a function, the router invokes the function every time
965
+ * it restores scroll position.
966
+ */
967
+ scrollOffset?: [number, number] | (() => [number, number]);
968
+ }
969
+ /**
970
+ * A DI token for the router service.
971
+ *
972
+ * @publicApi
973
+ */
974
+ declare const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>;
975
+
698
976
  /**
699
977
  * An `InjectionToken` provided by the `RouterOutlet` and can be set using the `routerOutletData`
700
978
  * input.
@@ -1034,6 +1312,7 @@ type RestoredState = {
1034
1312
  [k: string]: any;
1035
1313
  navigationId: number;
1036
1314
  ɵrouterPageId?: number;
1315
+ ɵrouterUrl?: string;
1037
1316
  };
1038
1317
  /**
1039
1318
  * Information about a navigation operation.
@@ -1878,21 +2157,6 @@ type Data = {
1878
2157
  type ResolveData = {
1879
2158
  [key: string | symbol]: ResolveFn<unknown> | DeprecatedResolve;
1880
2159
  };
1881
- /**
1882
- * An ES Module object with a default export of the given type.
1883
- *
1884
- * @see {@link Route#loadComponent}
1885
- * @see {@link LoadChildrenCallback}
1886
- *
1887
- * @publicApi
1888
- */
1889
- interface DefaultExport<T> {
1890
- /**
1891
- * Default exports are bound under the name `"default"`, per the ES Module spec:
1892
- * https://tc39.es/ecma262/#table-export-forms-mapping-to-exportentry-records
1893
- */
1894
- default: T;
1895
- }
1896
2160
  /**
1897
2161
  *
1898
2162
  * A function that is called to resolve a collection of lazy-loaded routes.
@@ -2425,7 +2689,8 @@ interface LoadedRouterConfig {
2425
2689
  *
2426
2690
  * @Injectable()
2427
2691
  * class CanActivateTeam implements CanActivate {
2428
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
2692
+ * private readonly permissions = inject(Permissions);
2693
+ * private readonly currentUser = inject(UserToken);
2429
2694
  *
2430
2695
  * canActivate(
2431
2696
  * route: ActivatedRouteSnapshot,
@@ -2538,7 +2803,8 @@ type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
2538
2803
  *
2539
2804
  * @Injectable()
2540
2805
  * class CanActivateTeam implements CanActivateChild {
2541
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
2806
+ * private readonly permissions = inject(Permissions);
2807
+ * private readonly currentUser = inject(UserToken);
2542
2808
  *
2543
2809
  * canActivateChild(
2544
2810
  * route: ActivatedRouteSnapshot,
@@ -2621,7 +2887,8 @@ type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStat
2621
2887
  * ```ts
2622
2888
  * @Injectable()
2623
2889
  * class CanDeactivateTeam implements CanDeactivate<TeamComponent> {
2624
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
2890
+ * private readonly permissions = inject(Permissions);
2891
+ * private readonly currentUser = inject(UserToken);
2625
2892
  *
2626
2893
  * canDeactivate(
2627
2894
  * component: TeamComponent,
@@ -2692,9 +2959,14 @@ type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, c
2692
2959
  *
2693
2960
  * @Injectable()
2694
2961
  * class CanMatchTeamSection implements CanMatch {
2695
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
2696
- *
2697
- * canMatch(route: Route, segments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean {
2962
+ * private readonly permissions = inject(Permissions);
2963
+ * private readonly currentUser = inject(UserToken);
2964
+ *
2965
+ * canMatch(
2966
+ * route: Route,
2967
+ * segments: UrlSegment[],
2968
+ * currentSnapshot: PartialMatchRouteSnapshot,
2969
+ * ): Observable<boolean> | Promise<boolean> | boolean {
2698
2970
  * return this.permissions.canAccess(this.currentUser, route, segments);
2699
2971
  * }
2700
2972
  * }
@@ -2732,7 +3004,7 @@ type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, c
2732
3004
  * @see [CanMatch](guide/routing/route-guards#canmatch)
2733
3005
  */
2734
3006
  interface CanMatch {
2735
- canMatch(route: Route, segments: UrlSegment[], currentSnapshot?: PartialMatchRouteSnapshot): MaybeAsync<GuardResult>;
3007
+ canMatch(route: Route, segments: UrlSegment[], currentSnapshot: PartialMatchRouteSnapshot): MaybeAsync<GuardResult>;
2736
3008
  }
2737
3009
  /**
2738
3010
  * The signature of a function used as a `canMatch` guard on a `Route`.
@@ -2748,15 +3020,13 @@ interface CanMatch {
2748
3020
  *
2749
3021
  * @param route The route configuration.
2750
3022
  * @param segments The URL segments that have not been consumed by previous parent route evaluations.
2751
- * @param currentSnapshot The current route snapshot up to this point in the matching process. While this parameter is optional,
2752
- * it will always be defined when called by the Router. It is only optional for backwards compatibility with functions defined prior
2753
- * to the introduction of this parameter.
3023
+ * @param currentSnapshot The current route snapshot up to this point in the matching process.
2754
3024
  *
2755
3025
  * @publicApi
2756
3026
  * @see {@link Route}
2757
3027
  * @see [CanMatch](guide/routing/route-guards#canmatch)
2758
3028
  */
2759
- type CanMatchFn = (route: Route, segments: UrlSegment[], currentSnapshot?: PartialMatchRouteSnapshot) => MaybeAsync<GuardResult>;
3029
+ type CanMatchFn = (route: Route, segments: UrlSegment[], currentSnapshot: PartialMatchRouteSnapshot) => MaybeAsync<GuardResult>;
2760
3030
  /**
2761
3031
  * A subset of the `ActivatedRouteSnapshot` interface that includes only the known data
2762
3032
  * up to the route matching phase. Some data are not accurately known
@@ -2784,7 +3054,7 @@ type PartialMatchRouteSnapshot = Pick<ActivatedRouteSnapshot, 'routeConfig' | 'u
2784
3054
  * ```ts
2785
3055
  * @Injectable({ providedIn: 'root' })
2786
3056
  * export class HeroResolver implements Resolve<Hero> {
2787
- * constructor(private service: HeroService) {}
3057
+ * private readonly service = inject(HeroService);
2788
3058
  *
2789
3059
  * resolve(
2790
3060
  * route: ActivatedRouteSnapshot,
@@ -2825,7 +3095,7 @@ type PartialMatchRouteSnapshot = Pick<ActivatedRouteSnapshot, 'routeConfig' | 'u
2825
3095
  * })
2826
3096
  * export class HeroComponent {
2827
3097
  *
2828
- * constructor(private activatedRoute: ActivatedRoute) {}
3098
+ * private readonly activatedRoute = inject(ActivatedRoute);
2829
3099
  *
2830
3100
  * ngOnInit() {
2831
3101
  * this.activatedRoute.data.subscribe(({ hero }) => {
@@ -2992,7 +3262,8 @@ type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
2992
3262
  *
2993
3263
  * @Injectable()
2994
3264
  * class CanLoadTeamSection implements CanLoad {
2995
- * constructor(private permissions: Permissions, private currentUser: UserToken) {}
3265
+ * private readonly permissions = inject(Permissions);
3266
+ * private readonly currentUser = inject(UserToken);
2996
3267
  *
2997
3268
  * canLoad(route: Route, segments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean {
2998
3269
  * return this.permissions.canLoadChildren(this.currentUser, route, segments);
@@ -3797,257 +4068,6 @@ declare class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit
3797
4068
  static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkActive, "[routerLinkActive]", ["routerLinkActive"], { "routerLinkActiveOptions": { "alias": "routerLinkActiveOptions"; "required": false; }; "ariaCurrentWhenActive": { "alias": "ariaCurrentWhenActive"; "required": false; }; "routerLinkActive": { "alias": "routerLinkActive"; "required": false; }; }, { "isActiveChange": "isActiveChange"; }, ["links"], never, true, never>;
3798
4069
  }
3799
4070
 
3800
- /**
3801
- * Allowed values in an `ExtraOptions` object that configure
3802
- * when the router performs the initial navigation operation.
3803
- *
3804
- * * 'enabledNonBlocking' - (default) The initial navigation starts after the
3805
- * root component has been created. The bootstrap is not blocked on the completion of the initial
3806
- * navigation.
3807
- * * 'enabledBlocking' - The initial navigation starts before the root component is created.
3808
- * The bootstrap is blocked until the initial navigation is complete. This value should be set in
3809
- * case you use [server-side rendering](guide/ssr), but do not enable [hydration](guide/hydration)
3810
- * for your application.
3811
- * * 'disabled' - The initial navigation is not performed. The location listener is set up before
3812
- * the root component gets created. Use if there is a reason to have
3813
- * more control over when the router starts its initial navigation due to some complex
3814
- * initialization logic.
3815
- *
3816
- * @see {@link /api/router/RouterModule#forRoot forRoot}
3817
- *
3818
- * @publicApi
3819
- */
3820
- type InitialNavigation = 'disabled' | 'enabledBlocking' | 'enabledNonBlocking';
3821
- /**
3822
- * Extra configuration options that can be used with the `withRouterConfig` function.
3823
- *
3824
- * @see [Router configuration options](guide/routing/customizing-route-behavior#router-configuration-options)
3825
- *
3826
- * @publicApi
3827
- */
3828
- interface RouterConfigOptions {
3829
- /**
3830
- * Configures how the Router attempts to restore state when a navigation is cancelled.
3831
- *
3832
- * 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
3833
- * router before the navigation started. This means that if the URL of the browser is updated
3834
- * _before_ the navigation is canceled, the Router will simply replace the item in history rather
3835
- * than trying to restore to the previous location in the session history. This happens most
3836
- * frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
3837
- * buttons.
3838
- *
3839
- * 'computed' - Will attempt to return to the same index in the session history that corresponds
3840
- * to the Angular route when the navigation gets cancelled. For example, if the browser back
3841
- * button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
3842
- * and vice versa.
3843
- *
3844
- * Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
3845
- * handles a portion of the URL because the history restoration navigates to the previous place in
3846
- * the browser history rather than simply resetting a portion of the URL.
3847
- *
3848
- * The default value is `replace` when not set.
3849
- *
3850
- * @see [Handle canceled navigations](guide/routing/customizing-route-behavior#handle-canceled-navigations)
3851
- *
3852
- */
3853
- canceledNavigationResolution?: 'replace' | 'computed';
3854
- /**
3855
- * Configures the default for handling a navigation request to the current URL.
3856
- *
3857
- * If unset, the `Router` will use `'ignore'`.
3858
- *
3859
- * @see {@link OnSameUrlNavigation}
3860
- *
3861
- * @see [React to same-URL navigations](guide/routing/customizing-route-behavior#react-to-same-url-navigations)
3862
- */
3863
- onSameUrlNavigation?: OnSameUrlNavigation;
3864
- /**
3865
- * Defines how the router merges parameters, data, and resolved data from parent to child
3866
- * routes.
3867
- *
3868
- * By default ('emptyOnly'), a route inherits the parent route's parameters when the route itself
3869
- * has an empty path (meaning its configured with path: '') or when the parent route doesn't have
3870
- * any component set.
3871
- *
3872
- * Set to 'always' to enable unconditional inheritance of parent parameters.
3873
- *
3874
- * Note that when dealing with matrix parameters, "parent" refers to the parent `Route`
3875
- * config which does not necessarily mean the "URL segment to the left". When the `Route` `path`
3876
- * contains multiple segments, the matrix parameters must appear on the last segment. For example,
3877
- * matrix parameters for `{path: 'a/b', component: MyComp}` should appear as `a/b;foo=bar` and not
3878
- * `a;foo=bar/b`.
3879
- *
3880
- * @see [Control parameter inheritance](guide/routing/customizing-route-behavior#control-parameter-inheritance)
3881
- *
3882
- */
3883
- paramsInheritanceStrategy?: 'emptyOnly' | 'always';
3884
- /**
3885
- * Defines when the router updates the browser URL. By default ('deferred'),
3886
- * update after successful navigation.
3887
- * Set to 'eager' if prefer to update the URL at the beginning of navigation.
3888
- * Updating the URL early allows you to handle a failure of navigation by
3889
- * showing an error message with the URL that failed.
3890
- *
3891
- * @see [Decide when the URL updates](guide/routing/customizing-route-behavior#decide-when-the-url-updates)
3892
- *
3893
- */
3894
- urlUpdateStrategy?: 'deferred' | 'eager';
3895
- /**
3896
- * The default strategy to use for handling query params in `Router.createUrlTree` when one is not provided.
3897
- *
3898
- * The `createUrlTree` method is used internally by `Router.navigate` and `RouterLink`.
3899
- * Note that `QueryParamsHandling` does not apply to `Router.navigateByUrl`.
3900
- *
3901
- * When neither the default nor the queryParamsHandling option is specified in the call to `createUrlTree`,
3902
- * the current parameters will be replaced by new parameters.
3903
- *
3904
- * @see {@link Router#createUrlTree}
3905
- * @see {@link QueryParamsHandling}
3906
- *
3907
- * @see [Choose default query parameter handling](guide/routing/customizing-route-behavior#choose-default-query-parameter-handling)
3908
-
3909
- *
3910
- */
3911
- defaultQueryParamsHandling?: QueryParamsHandling;
3912
- /**
3913
- * When `true`, the `Promise` will instead resolve with `false`, as it does with other failed
3914
- * navigations (for example, when guards are rejected).
3915
-
3916
- * Otherwise the `Promise` returned by the Router's navigation with be rejected
3917
- * if an error occurs.
3918
- */
3919
- resolveNavigationPromiseOnError?: boolean;
3920
- }
3921
- /**
3922
- * Configuration options for the scrolling feature which can be used with `withInMemoryScrolling`
3923
- * function or `RouterModule.forRoot`.
3924
- *
3925
- * @publicApi
3926
- * @see withInMemoryScrolling
3927
- * @see RouterModule#forRoot
3928
- */
3929
- interface InMemoryScrollingOptions {
3930
- /**
3931
- * When set to 'enabled', scrolls to the anchor element when the URL has a fragment.
3932
- * Anchor scrolling is disabled by default.
3933
- *
3934
- * Anchor scrolling does not happen on 'popstate'. Instead, we restore the position
3935
- * that we stored or scroll to the top.
3936
- */
3937
- anchorScrolling?: 'disabled' | 'enabled';
3938
- /**
3939
- * Configures if the scroll position needs to be restored when navigating back.
3940
- *
3941
- * * 'disabled'- (Default) Does nothing. Scroll position is maintained on navigation.
3942
- * * 'top'- Sets the scroll position to x = 0, y = 0 on all navigation.
3943
- * * 'enabled'- Restores the previous scroll position on backward navigation, else sets the
3944
- * position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
3945
- * navigation). This option will be the default in the future.
3946
- *
3947
- * You can implement custom scroll restoration behavior by adapting the enabled behavior as
3948
- * in the following example.
3949
- *
3950
- * ```ts
3951
- * class AppComponent {
3952
- * movieData: any;
3953
- *
3954
- * constructor(private router: Router, private viewportScroller: ViewportScroller,
3955
- * changeDetectorRef: ChangeDetectorRef) {
3956
- * router.events.pipe(filter((event: Event): event is Scroll => event instanceof Scroll)
3957
- * ).subscribe(e => {
3958
- * fetch('http://example.com/movies.json').then(response => {
3959
- * this.movieData = response.json();
3960
- * // update the template with the data before restoring scroll
3961
- * changeDetectorRef.detectChanges();
3962
- *
3963
- * if (e.position) {
3964
- * viewportScroller.scrollToPosition(e.position);
3965
- * }
3966
- * });
3967
- * });
3968
- * }
3969
- * }
3970
- * ```
3971
- */
3972
- scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
3973
- }
3974
- /**
3975
- * A set of configuration options for a router module, provided in the
3976
- * `forRoot()` method.
3977
- *
3978
- * @see {@link /api/router/routerModule#forRoot forRoot}
3979
- *
3980
- *
3981
- * @publicApi
3982
- */
3983
- interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
3984
- /**
3985
- * When true, log all internal navigation events to the console.
3986
- * Use for debugging.
3987
- */
3988
- enableTracing?: boolean;
3989
- /**
3990
- * When true, enable the location strategy that uses the URL fragment
3991
- * instead of the history API.
3992
- */
3993
- useHash?: boolean;
3994
- /**
3995
- * One of `enabled`, `enabledBlocking`, `enabledNonBlocking` or `disabled`.
3996
- * When set to `enabled` or `enabledBlocking`, the initial navigation starts before the root
3997
- * component is created. The bootstrap is blocked until the initial navigation is complete. This
3998
- * value should be set in case you use [server-side rendering](guide/ssr), but do not enable
3999
- * [hydration](guide/hydration) for your application. When set to `enabledNonBlocking`,
4000
- * the initial navigation starts after the root component has been created.
4001
- * The bootstrap is not blocked on the completion of the initial navigation. When set to
4002
- * `disabled`, the initial navigation is not performed. The location listener is set up before the
4003
- * root component gets created. Use if there is a reason to have more control over when the router
4004
- * starts its initial navigation due to some complex initialization logic.
4005
- */
4006
- initialNavigation?: InitialNavigation;
4007
- /**
4008
- * When true, enables binding information from the `Router` state directly to the inputs of the
4009
- * component in `Route` configurations.
4010
- */
4011
- bindToComponentInputs?: boolean;
4012
- /**
4013
- * When true, enables view transitions in the Router by running the route activation and
4014
- * deactivation inside of `document.startViewTransition`.
4015
- *
4016
- * @see https://developer.chrome.com/docs/web-platform/view-transitions/
4017
- * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
4018
- * @experimental 17.0
4019
- */
4020
- enableViewTransitions?: boolean;
4021
- /**
4022
- * A custom error handler for failed navigations.
4023
- * If the handler returns a value, the navigation Promise is resolved with this value.
4024
- * If the handler throws an exception, the navigation Promise is rejected with the exception.
4025
- *
4026
- * @see RouterConfigOptions
4027
- */
4028
- errorHandler?: (error: any) => RedirectCommand | any;
4029
- /**
4030
- * Configures a preloading strategy.
4031
- * One of `PreloadAllModules` or `NoPreloading` (the default).
4032
- */
4033
- preloadingStrategy?: any;
4034
- /**
4035
- * Configures the scroll offset the router will use when scrolling to an element.
4036
- *
4037
- * When given a tuple with x and y position value,
4038
- * the router uses that offset each time it scrolls.
4039
- * When given a function, the router invokes the function every time
4040
- * it restores scroll position.
4041
- */
4042
- scrollOffset?: [number, number] | (() => [number, number]);
4043
- }
4044
- /**
4045
- * A DI token for the router service.
4046
- *
4047
- * @publicApi
4048
- */
4049
- declare const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>;
4050
-
4051
4071
  /**
4052
4072
  * This component is used internally within the router to be a placeholder when an empty
4053
4073
  * router-outlet is needed. For example, with a config such as:
@@ -4135,4 +4155,4 @@ declare class RouterModule {
4135
4155
  declare const ROUTER_INITIALIZER: InjectionToken<(compRef: ComponentRef<any>) => void>;
4136
4156
 
4137
4157
  export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, PRIMARY_OUTLET, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, ROUTER_PROVIDERS, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterModule, RouterOutlet, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, convertToParamMap, defaultUrlMatcher, destroyDetachedRouteHandle, isActive, ɵEmptyOutletComponent };
4138
- export type { CanActivate, CanActivateChild, CanActivateChildFn, CanActivateFn, CanDeactivate, CanDeactivateFn, CanLoad, CanLoadFn, CanMatch, CanMatchFn, Data, DefaultExport, DeprecatedGuard, DeprecatedResolve, DetachedRouteHandle, Event, ExtraOptions, GuardResult, InMemoryScrollingOptions, InitialNavigation, IsActiveMatchOptions, LoadChildren, LoadChildrenCallback, LoadedRouterConfig, MaybeAsync, Navigation, NavigationBehaviorOptions, NavigationExtras, OnSameUrlNavigation, ParamMap, Params, PartialMatchRouteSnapshot, QueryParamsHandling, RedirectFunction, Resolve, ResolveData, ResolveFn, RestoredState, Route, RouterConfigOptions, RouterOutletContract, Routes, RunGuardsAndResolvers, UrlCreationOptions, UrlMatchResult, UrlMatcher };
4158
+ export type { CanActivate, CanActivateChild, CanActivateChildFn, CanActivateFn, CanDeactivate, CanDeactivateFn, CanLoad, CanLoadFn, CanMatch, CanMatchFn, ComponentInputBindingOptions, Data, DeprecatedGuard, DeprecatedResolve, DetachedRouteHandle, Event, ExtraOptions, GuardResult, InMemoryScrollingOptions, InitialNavigation, IsActiveMatchOptions, LoadChildren, LoadChildrenCallback, LoadedRouterConfig, MaybeAsync, Navigation, NavigationBehaviorOptions, NavigationExtras, OnSameUrlNavigation, ParamMap, Params, PartialMatchRouteSnapshot, QueryParamsHandling, RedirectFunction, Resolve, ResolveData, ResolveFn, RestoredState, Route, RouterConfigOptions, RouterOutletContract, Routes, RunGuardsAndResolvers, UrlCreationOptions, UrlMatchResult, UrlMatcher };