@angular/router 22.0.0-next.0 → 22.0.0-next.10
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 +110 -73
- package/fesm2022/_router-chunk.mjs.map +1 -1
- package/fesm2022/_router_module-chunk.mjs +44 -38
- 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 +18 -16
- 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 +293 -268
- package/types/router.d.ts +22 -7
- 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.10
|
|
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,274 @@ 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
|
+
/**
|
|
889
|
+
* A set of configuration options for a router module, provided in the
|
|
890
|
+
* `forRoot()` method.
|
|
891
|
+
*
|
|
892
|
+
* @see {@link /api/router/RouterModule#forRoot forRoot}
|
|
893
|
+
*
|
|
894
|
+
*
|
|
895
|
+
* @publicApi
|
|
896
|
+
*/
|
|
897
|
+
interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions {
|
|
898
|
+
/**
|
|
899
|
+
* When true, log all internal navigation events to the console.
|
|
900
|
+
* Use for debugging.
|
|
901
|
+
*/
|
|
902
|
+
enableTracing?: boolean;
|
|
903
|
+
/**
|
|
904
|
+
* When true, enable the location strategy that uses the URL fragment
|
|
905
|
+
* instead of the history API.
|
|
906
|
+
*/
|
|
907
|
+
useHash?: boolean;
|
|
908
|
+
/**
|
|
909
|
+
* One of `enabled`, `enabledBlocking`, `enabledNonBlocking` or `disabled`.
|
|
910
|
+
* When set to `enabled` or `enabledBlocking`, the initial navigation starts before the root
|
|
911
|
+
* component is created. The bootstrap is blocked until the initial navigation is complete. This
|
|
912
|
+
* value should be set in case you use [server-side rendering](guide/ssr), but do not enable
|
|
913
|
+
* [hydration](guide/hydration) for your application. When set to `enabledNonBlocking`,
|
|
914
|
+
* the initial navigation starts after the root component has been created.
|
|
915
|
+
* The bootstrap is not blocked on the completion of the initial navigation. When set to
|
|
916
|
+
* `disabled`, the initial navigation is not performed. The location listener is set up before the
|
|
917
|
+
* root component gets created. Use if there is a reason to have more control over when the router
|
|
918
|
+
* starts its initial navigation due to some complex initialization logic.
|
|
919
|
+
*/
|
|
920
|
+
initialNavigation?: InitialNavigation;
|
|
921
|
+
/**
|
|
922
|
+
* When true, enables binding information from the `Router` state directly to the inputs of the
|
|
923
|
+
* component in `Route` configurations. Can also accept an `ComponentInputBindingOptions` object
|
|
924
|
+
* to set whether to exclude queryParams from binding.
|
|
925
|
+
*/
|
|
926
|
+
bindToComponentInputs?: boolean | ComponentInputBindingOptions;
|
|
927
|
+
/**
|
|
928
|
+
* When true, enables view transitions in the Router by running the route activation and
|
|
929
|
+
* deactivation inside of `document.startViewTransition`.
|
|
930
|
+
*
|
|
931
|
+
* @see https://developer.chrome.com/docs/web-platform/view-transitions/
|
|
932
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
|
|
933
|
+
* @experimental 17.0
|
|
934
|
+
*/
|
|
935
|
+
enableViewTransitions?: boolean;
|
|
936
|
+
/**
|
|
937
|
+
* A custom error handler for failed navigations.
|
|
938
|
+
* If the handler returns a value, the navigation Promise is resolved with this value.
|
|
939
|
+
* If the handler throws an exception, the navigation Promise is rejected with the exception.
|
|
940
|
+
*
|
|
941
|
+
* @see RouterConfigOptions
|
|
942
|
+
*/
|
|
943
|
+
errorHandler?: (error: any) => RedirectCommand | any;
|
|
944
|
+
/**
|
|
945
|
+
* Configures a preloading strategy.
|
|
946
|
+
* One of `PreloadAllModules` or `NoPreloading` (the default).
|
|
947
|
+
*/
|
|
948
|
+
preloadingStrategy?: any;
|
|
949
|
+
/**
|
|
950
|
+
* Configures the scroll offset the router will use when scrolling to an element.
|
|
951
|
+
*
|
|
952
|
+
* When given a tuple with x and y position value,
|
|
953
|
+
* the router uses that offset each time it scrolls.
|
|
954
|
+
* When given a function, the router invokes the function every time
|
|
955
|
+
* it restores scroll position.
|
|
956
|
+
*/
|
|
957
|
+
scrollOffset?: [number, number] | (() => [number, number]);
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* A DI token for the router service.
|
|
961
|
+
*
|
|
962
|
+
* @publicApi
|
|
963
|
+
*/
|
|
964
|
+
declare const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>;
|
|
965
|
+
|
|
698
966
|
/**
|
|
699
967
|
* An `InjectionToken` provided by the `RouterOutlet` and can be set using the `routerOutletData`
|
|
700
968
|
* input.
|
|
@@ -1034,6 +1302,7 @@ type RestoredState = {
|
|
|
1034
1302
|
[k: string]: any;
|
|
1035
1303
|
navigationId: number;
|
|
1036
1304
|
ɵrouterPageId?: number;
|
|
1305
|
+
ɵrouterUrl?: string;
|
|
1037
1306
|
};
|
|
1038
1307
|
/**
|
|
1039
1308
|
* Information about a navigation operation.
|
|
@@ -2425,7 +2694,8 @@ interface LoadedRouterConfig {
|
|
|
2425
2694
|
*
|
|
2426
2695
|
* @Injectable()
|
|
2427
2696
|
* class CanActivateTeam implements CanActivate {
|
|
2428
|
-
*
|
|
2697
|
+
* private readonly permissions = inject(Permissions);
|
|
2698
|
+
* private readonly currentUser = inject(UserToken);
|
|
2429
2699
|
*
|
|
2430
2700
|
* canActivate(
|
|
2431
2701
|
* route: ActivatedRouteSnapshot,
|
|
@@ -2538,7 +2808,8 @@ type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
|
|
|
2538
2808
|
*
|
|
2539
2809
|
* @Injectable()
|
|
2540
2810
|
* class CanActivateTeam implements CanActivateChild {
|
|
2541
|
-
*
|
|
2811
|
+
* private readonly permissions = inject(Permissions);
|
|
2812
|
+
* private readonly currentUser = inject(UserToken);
|
|
2542
2813
|
*
|
|
2543
2814
|
* canActivateChild(
|
|
2544
2815
|
* route: ActivatedRouteSnapshot,
|
|
@@ -2621,7 +2892,8 @@ type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStat
|
|
|
2621
2892
|
* ```ts
|
|
2622
2893
|
* @Injectable()
|
|
2623
2894
|
* class CanDeactivateTeam implements CanDeactivate<TeamComponent> {
|
|
2624
|
-
*
|
|
2895
|
+
* private readonly permissions = inject(Permissions);
|
|
2896
|
+
* private readonly currentUser = inject(UserToken);
|
|
2625
2897
|
*
|
|
2626
2898
|
* canDeactivate(
|
|
2627
2899
|
* component: TeamComponent,
|
|
@@ -2692,9 +2964,14 @@ type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, c
|
|
|
2692
2964
|
*
|
|
2693
2965
|
* @Injectable()
|
|
2694
2966
|
* class CanMatchTeamSection implements CanMatch {
|
|
2695
|
-
*
|
|
2696
|
-
*
|
|
2697
|
-
*
|
|
2967
|
+
* private readonly permissions = inject(Permissions);
|
|
2968
|
+
* private readonly currentUser = inject(UserToken);
|
|
2969
|
+
*
|
|
2970
|
+
* canMatch(
|
|
2971
|
+
* route: Route,
|
|
2972
|
+
* segments: UrlSegment[],
|
|
2973
|
+
* currentSnapshot: PartialMatchRouteSnapshot,
|
|
2974
|
+
* ): Observable<boolean> | Promise<boolean> | boolean {
|
|
2698
2975
|
* return this.permissions.canAccess(this.currentUser, route, segments);
|
|
2699
2976
|
* }
|
|
2700
2977
|
* }
|
|
@@ -2732,7 +3009,7 @@ type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, c
|
|
|
2732
3009
|
* @see [CanMatch](guide/routing/route-guards#canmatch)
|
|
2733
3010
|
*/
|
|
2734
3011
|
interface CanMatch {
|
|
2735
|
-
canMatch(route: Route, segments: UrlSegment[], currentSnapshot
|
|
3012
|
+
canMatch(route: Route, segments: UrlSegment[], currentSnapshot: PartialMatchRouteSnapshot): MaybeAsync<GuardResult>;
|
|
2736
3013
|
}
|
|
2737
3014
|
/**
|
|
2738
3015
|
* The signature of a function used as a `canMatch` guard on a `Route`.
|
|
@@ -2748,15 +3025,13 @@ interface CanMatch {
|
|
|
2748
3025
|
*
|
|
2749
3026
|
* @param route The route configuration.
|
|
2750
3027
|
* @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.
|
|
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.
|
|
3028
|
+
* @param currentSnapshot The current route snapshot up to this point in the matching process.
|
|
2754
3029
|
*
|
|
2755
3030
|
* @publicApi
|
|
2756
3031
|
* @see {@link Route}
|
|
2757
3032
|
* @see [CanMatch](guide/routing/route-guards#canmatch)
|
|
2758
3033
|
*/
|
|
2759
|
-
type CanMatchFn = (route: Route, segments: UrlSegment[], currentSnapshot
|
|
3034
|
+
type CanMatchFn = (route: Route, segments: UrlSegment[], currentSnapshot: PartialMatchRouteSnapshot) => MaybeAsync<GuardResult>;
|
|
2760
3035
|
/**
|
|
2761
3036
|
* A subset of the `ActivatedRouteSnapshot` interface that includes only the known data
|
|
2762
3037
|
* up to the route matching phase. Some data are not accurately known
|
|
@@ -2784,7 +3059,7 @@ type PartialMatchRouteSnapshot = Pick<ActivatedRouteSnapshot, 'routeConfig' | 'u
|
|
|
2784
3059
|
* ```ts
|
|
2785
3060
|
* @Injectable({ providedIn: 'root' })
|
|
2786
3061
|
* export class HeroResolver implements Resolve<Hero> {
|
|
2787
|
-
*
|
|
3062
|
+
* private readonly service = inject(HeroService);
|
|
2788
3063
|
*
|
|
2789
3064
|
* resolve(
|
|
2790
3065
|
* route: ActivatedRouteSnapshot,
|
|
@@ -2825,7 +3100,7 @@ type PartialMatchRouteSnapshot = Pick<ActivatedRouteSnapshot, 'routeConfig' | 'u
|
|
|
2825
3100
|
* })
|
|
2826
3101
|
* export class HeroComponent {
|
|
2827
3102
|
*
|
|
2828
|
-
*
|
|
3103
|
+
* private readonly activatedRoute = inject(ActivatedRoute);
|
|
2829
3104
|
*
|
|
2830
3105
|
* ngOnInit() {
|
|
2831
3106
|
* this.activatedRoute.data.subscribe(({ hero }) => {
|
|
@@ -2992,7 +3267,8 @@ type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
|
|
|
2992
3267
|
*
|
|
2993
3268
|
* @Injectable()
|
|
2994
3269
|
* class CanLoadTeamSection implements CanLoad {
|
|
2995
|
-
*
|
|
3270
|
+
* private readonly permissions = inject(Permissions);
|
|
3271
|
+
* private readonly currentUser = inject(UserToken);
|
|
2996
3272
|
*
|
|
2997
3273
|
* canLoad(route: Route, segments: UrlSegment[]): Observable<boolean>|Promise<boolean>|boolean {
|
|
2998
3274
|
* return this.permissions.canLoadChildren(this.currentUser, route, segments);
|
|
@@ -3797,257 +4073,6 @@ declare class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit
|
|
|
3797
4073
|
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
4074
|
}
|
|
3799
4075
|
|
|
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
4076
|
/**
|
|
4052
4077
|
* This component is used internally within the router to be a placeholder when an empty
|
|
4053
4078
|
* router-outlet is needed. For example, with a config such as:
|
|
@@ -4135,4 +4160,4 @@ declare class RouterModule {
|
|
|
4135
4160
|
declare const ROUTER_INITIALIZER: InjectionToken<(compRef: ComponentRef<any>) => void>;
|
|
4136
4161
|
|
|
4137
4162
|
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 };
|
|
4163
|
+
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 };
|