@angular/router 22.0.0-next.3 → 22.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/_router-chunk.mjs +60 -52
- package/fesm2022/_router-chunk.mjs.map +1 -1
- package/fesm2022/_router_module-chunk.mjs +36 -36
- package/fesm2022/_router_module-chunk.mjs.map +1 -1
- package/fesm2022/router.mjs +2 -2
- package/fesm2022/router.mjs.map +1 -1
- package/fesm2022/testing.mjs +14 -14
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +1 -1
- package/fesm2022/upgrade.mjs.map +1 -1
- package/package.json +4 -4
- package/types/_router_module-chunk.d.ts +270 -254
- package/types/router.d.ts +19 -5
- package/types/testing.d.ts +1 -1
- package/types/upgrade.d.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v22.0.0-next.
|
|
2
|
+
* @license Angular v22.0.0-next.4
|
|
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,
|
|
8
|
+
import { InjectionToken, EnvironmentInjector, ComponentRef, EventEmitter, Signal, OnDestroy, OnInit, SimpleChanges, Type, 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,273 @@ 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 ('emptyOnly'), a route inherits the parent route's parameters when the route itself
|
|
767
|
+
* has an empty path (meaning its configured with path: '') or when the parent route doesn't have
|
|
768
|
+
* any component set.
|
|
769
|
+
*
|
|
770
|
+
* Set to 'always' to enable unconditional inheritance of parent parameters.
|
|
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
|
+
*/
|
|
880
|
+
interface ComponentInputBindingOptions {
|
|
881
|
+
/**
|
|
882
|
+
* When true (default), will configure query parameters to bind to component
|
|
883
|
+
* inputs.
|
|
884
|
+
*/
|
|
885
|
+
queryParams?: boolean;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* A set of configuration options for a router module, provided in the
|
|
889
|
+
* `forRoot()` method.
|
|
890
|
+
*
|
|
891
|
+
* @see {@link /api/router/routerModule#forRoot forRoot}
|
|
892
|
+
*
|
|
893
|
+
*
|
|
894
|
+
* @publicApi
|
|
895
|
+
*/
|
|
896
|
+
interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
|
|
897
|
+
/**
|
|
898
|
+
* When true, log all internal navigation events to the console.
|
|
899
|
+
* Use for debugging.
|
|
900
|
+
*/
|
|
901
|
+
enableTracing?: boolean;
|
|
902
|
+
/**
|
|
903
|
+
* When true, enable the location strategy that uses the URL fragment
|
|
904
|
+
* instead of the history API.
|
|
905
|
+
*/
|
|
906
|
+
useHash?: boolean;
|
|
907
|
+
/**
|
|
908
|
+
* One of `enabled`, `enabledBlocking`, `enabledNonBlocking` or `disabled`.
|
|
909
|
+
* When set to `enabled` or `enabledBlocking`, the initial navigation starts before the root
|
|
910
|
+
* component is created. The bootstrap is blocked until the initial navigation is complete. This
|
|
911
|
+
* value should be set in case you use [server-side rendering](guide/ssr), but do not enable
|
|
912
|
+
* [hydration](guide/hydration) for your application. When set to `enabledNonBlocking`,
|
|
913
|
+
* the initial navigation starts after the root component has been created.
|
|
914
|
+
* The bootstrap is not blocked on the completion of the initial navigation. When set to
|
|
915
|
+
* `disabled`, the initial navigation is not performed. The location listener is set up before the
|
|
916
|
+
* root component gets created. Use if there is a reason to have more control over when the router
|
|
917
|
+
* starts its initial navigation due to some complex initialization logic.
|
|
918
|
+
*/
|
|
919
|
+
initialNavigation?: InitialNavigation;
|
|
920
|
+
/**
|
|
921
|
+
* When true, enables binding information from the `Router` state directly to the inputs of the
|
|
922
|
+
* component in `Route` configurations. Can also accept an `ComponentInputBindingOptions` object
|
|
923
|
+
* to set whether to exclude queryParams from binding.
|
|
924
|
+
*/
|
|
925
|
+
bindToComponentInputs?: boolean | ComponentInputBindingOptions;
|
|
926
|
+
/**
|
|
927
|
+
* When true, enables view transitions in the Router by running the route activation and
|
|
928
|
+
* deactivation inside of `document.startViewTransition`.
|
|
929
|
+
*
|
|
930
|
+
* @see https://developer.chrome.com/docs/web-platform/view-transitions/
|
|
931
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
|
|
932
|
+
* @experimental 17.0
|
|
933
|
+
*/
|
|
934
|
+
enableViewTransitions?: boolean;
|
|
935
|
+
/**
|
|
936
|
+
* A custom error handler for failed navigations.
|
|
937
|
+
* If the handler returns a value, the navigation Promise is resolved with this value.
|
|
938
|
+
* If the handler throws an exception, the navigation Promise is rejected with the exception.
|
|
939
|
+
*
|
|
940
|
+
* @see RouterConfigOptions
|
|
941
|
+
*/
|
|
942
|
+
errorHandler?: (error: any) => RedirectCommand | any;
|
|
943
|
+
/**
|
|
944
|
+
* Configures a preloading strategy.
|
|
945
|
+
* One of `PreloadAllModules` or `NoPreloading` (the default).
|
|
946
|
+
*/
|
|
947
|
+
preloadingStrategy?: any;
|
|
948
|
+
/**
|
|
949
|
+
* Configures the scroll offset the router will use when scrolling to an element.
|
|
950
|
+
*
|
|
951
|
+
* When given a tuple with x and y position value,
|
|
952
|
+
* the router uses that offset each time it scrolls.
|
|
953
|
+
* When given a function, the router invokes the function every time
|
|
954
|
+
* it restores scroll position.
|
|
955
|
+
*/
|
|
956
|
+
scrollOffset?: [number, number] | (() => [number, number]);
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* A DI token for the router service.
|
|
960
|
+
*
|
|
961
|
+
* @publicApi
|
|
962
|
+
*/
|
|
963
|
+
declare const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>;
|
|
964
|
+
|
|
698
965
|
/**
|
|
699
966
|
* An `InjectionToken` provided by the `RouterOutlet` and can be set using the `routerOutletData`
|
|
700
967
|
* input.
|
|
@@ -3797,257 +4064,6 @@ declare class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit
|
|
|
3797
4064
|
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
4065
|
}
|
|
3799
4066
|
|
|
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
4067
|
/**
|
|
4052
4068
|
* This component is used internally within the router to be a placeholder when an empty
|
|
4053
4069
|
* router-outlet is needed. For example, with a config such as:
|
|
@@ -4135,4 +4151,4 @@ declare class RouterModule {
|
|
|
4135
4151
|
declare const ROUTER_INITIALIZER: InjectionToken<(compRef: ComponentRef<any>) => void>;
|
|
4136
4152
|
|
|
4137
4153
|
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 };
|
|
4154
|
+
export type { CanActivate, CanActivateChild, CanActivateChildFn, CanActivateFn, CanDeactivate, CanDeactivateFn, CanLoad, CanLoadFn, CanMatch, CanMatchFn, ComponentInputBindingOptions, 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 };
|
package/types/router.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v22.0.0-next.
|
|
2
|
+
* @license Angular v22.0.0-next.4
|
|
3
3
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { RouterOutletContract, ActivatedRoute, ActivatedRouteSnapshot, Params, DefaultUrlSerializer, UrlTree, RouterStateSnapshot, Route, LoadedRouterConfig, Router, Routes,
|
|
7
|
+
import { RouterOutletContract, ActivatedRoute, ActivatedRouteSnapshot, Params, DefaultUrlSerializer, UrlTree, RouterStateSnapshot, Route, LoadedRouterConfig, Router, Routes, ComponentInputBindingOptions, InMemoryScrollingOptions, NavigationError, RedirectCommand, RouterConfigOptions, CanActivate, CanActivateFn, CanActivateChild, CanActivateChildFn, CanDeactivate, CanDeactivateFn, CanMatch, CanMatchFn, Resolve, ResolveFn, Event } from './_router_module-chunk.js';
|
|
8
8
|
export { ActivationEnd, ActivationStart, BaseRouteReuseStrategy, CanLoad, CanLoadFn, ChildActivationEnd, ChildActivationStart, Data, DefaultExport, DeprecatedGuard, DeprecatedResolve, DetachedRouteHandle, EventType, ExtraOptions, GuardResult, GuardsCheckEnd, GuardsCheckStart, InitialNavigation, IsActiveMatchOptions, LoadChildren, LoadChildrenCallback, MaybeAsync, Navigation, NavigationBehaviorOptions, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationExtras, NavigationSkipped, NavigationSkippedCode, NavigationStart, OnSameUrlNavigation, PRIMARY_OUTLET, ParamMap, PartialMatchRouteSnapshot, QueryParamsHandling, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, RedirectFunction, ResolveData, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterState, RoutesRecognized, RunGuardsAndResolvers, Scroll, UrlCreationOptions, UrlMatchResult, UrlMatcher, UrlSegment, UrlSegmentGroup, UrlSerializer, convertToParamMap, defaultUrlMatcher, destroyDetachedRouteHandle, isActive, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, RestoredState as ɵRestoredState } from './_router_module-chunk.js';
|
|
9
9
|
import { Title } from '@angular/platform-browser';
|
|
10
10
|
import * as i0 from '@angular/core';
|
|
11
|
-
import {
|
|
11
|
+
import { EnvironmentInjector, ComponentRef, InjectionToken, Type, Injector, Compiler, OnDestroy, Provider, EnvironmentProviders, Version } from '@angular/core';
|
|
12
12
|
import { Observable } from 'rxjs';
|
|
13
13
|
import '@angular/common';
|
|
14
14
|
|
|
@@ -780,7 +780,8 @@ type ComponentInputBindingFeature = RouterFeature<RouterFeatureKind.ComponentInp
|
|
|
780
780
|
type ViewTransitionsFeature = RouterFeature<RouterFeatureKind.ViewTransitionsFeature>;
|
|
781
781
|
/**
|
|
782
782
|
* Enables binding information from the `Router` state directly to the inputs of the component in
|
|
783
|
-
* `Route` configurations.
|
|
783
|
+
* `Route` configurations. Can also accept an `ComponentInputBindingOptions` object to set which
|
|
784
|
+
* sources are allowed to bind.
|
|
784
785
|
*
|
|
785
786
|
* @usageNotes
|
|
786
787
|
*
|
|
@@ -813,10 +814,23 @@ type ViewTransitionsFeature = RouterFeature<RouterFeatureKind.ViewTransitionsFea
|
|
|
813
814
|
* Default values can be provided with a resolver on the route to ensure the value is always present
|
|
814
815
|
* or an input and use an input transform in the component.
|
|
815
816
|
*
|
|
817
|
+
* Advanced example of how you can disable binding from certain sources:
|
|
818
|
+
* ```ts
|
|
819
|
+
* const appRoutes: Routes = [];
|
|
820
|
+
* bootstrapApplication(AppComponent,
|
|
821
|
+
* {
|
|
822
|
+
* providers: [
|
|
823
|
+
* provideRouter(appRoutes, withComponentInputBinding({queryParams: false}))
|
|
824
|
+
* ]
|
|
825
|
+
* }
|
|
826
|
+
* );
|
|
827
|
+
* ```
|
|
828
|
+
*
|
|
816
829
|
* @see {@link /guide/components/inputs#input-transforms Input Transforms}
|
|
830
|
+
* @see {@link ComponentInputBindingOptions}
|
|
817
831
|
* @returns A set of providers for use with `provideRouter`.
|
|
818
832
|
*/
|
|
819
|
-
declare function withComponentInputBinding(): ComponentInputBindingFeature;
|
|
833
|
+
declare function withComponentInputBinding(options?: ComponentInputBindingOptions): ComponentInputBindingFeature;
|
|
820
834
|
/**
|
|
821
835
|
* Enables view transitions in the Router by running the route activation and deactivation inside of
|
|
822
836
|
* `document.startViewTransition`.
|
package/types/testing.d.ts
CHANGED
package/types/upgrade.d.ts
CHANGED