@angular/router 17.3.1 → 18.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/esm2022/src/apply_redirects.mjs +16 -7
  2. package/esm2022/src/components/empty_outlet.mjs +3 -3
  3. package/esm2022/src/directives/router_link.mjs +3 -3
  4. package/esm2022/src/directives/router_link_active.mjs +3 -3
  5. package/esm2022/src/directives/router_outlet.mjs +6 -6
  6. package/esm2022/src/events.mjs +3 -2
  7. package/esm2022/src/index.mjs +2 -1
  8. package/esm2022/src/models.mjs +16 -2
  9. package/esm2022/src/navigation_canceling_error.mjs +1 -1
  10. package/esm2022/src/navigation_transition.mjs +7 -7
  11. package/esm2022/src/operators/check_guards.mjs +2 -3
  12. package/esm2022/src/operators/prioritized_guard_value.mjs +8 -4
  13. package/esm2022/src/page_title_strategy.mjs +6 -6
  14. package/esm2022/src/recognize.mjs +36 -39
  15. package/esm2022/src/route_reuse_strategy.mjs +6 -6
  16. package/esm2022/src/router.mjs +8 -5
  17. package/esm2022/src/router_config_loader.mjs +3 -3
  18. package/esm2022/src/router_module.mjs +4 -4
  19. package/esm2022/src/router_outlet_context.mjs +3 -3
  20. package/esm2022/src/router_preloader.mjs +9 -9
  21. package/esm2022/src/router_scroller.mjs +3 -3
  22. package/esm2022/src/shared.mjs +2 -2
  23. package/esm2022/src/statemanager/state_manager.mjs +6 -6
  24. package/esm2022/src/url_handling_strategy.mjs +6 -6
  25. package/esm2022/src/url_tree.mjs +3 -3
  26. package/esm2022/src/version.mjs +1 -1
  27. package/esm2022/testing/src/router_testing_harness.mjs +6 -6
  28. package/esm2022/testing/src/router_testing_module.mjs +4 -4
  29. package/fesm2022/router.mjs +153 -124
  30. package/fesm2022/router.mjs.map +1 -1
  31. package/fesm2022/testing.mjs +11 -11
  32. package/fesm2022/upgrade.mjs +1 -1
  33. package/index.d.ts +41 -5
  34. package/package.json +4 -4
  35. package/testing/index.d.ts +1 -1
  36. package/upgrade/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.3.1
2
+ * @license Angular v18.0.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -90,7 +90,7 @@ function defaultUrlMatcher(segments, segmentGroup, route) {
90
90
  for (let index = 0; index < parts.length; index++) {
91
91
  const part = parts[index];
92
92
  const segment = segments[index];
93
- const isParameter = part.startsWith(':');
93
+ const isParameter = part[0] === ':';
94
94
  if (isParameter) {
95
95
  posParams[part.substring(1)] = segment;
96
96
  }
@@ -421,10 +421,10 @@ function mapChildrenIntoArray(segment, fn) {
421
421
  * @publicApi
422
422
  */
423
423
  class UrlSerializer {
424
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
425
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }); }
424
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
425
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }); }
426
426
  }
427
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UrlSerializer, decorators: [{
427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: UrlSerializer, decorators: [{
428
428
  type: Injectable,
429
429
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
430
430
  }] });
@@ -1743,8 +1743,9 @@ class Scroll {
1743
1743
  class BeforeActivateRoutes {
1744
1744
  }
1745
1745
  class RedirectRequest {
1746
- constructor(url) {
1746
+ constructor(url, navigationBehaviorOptions) {
1747
1747
  this.url = url;
1748
+ this.navigationBehaviorOptions = navigationBehaviorOptions;
1748
1749
  }
1749
1750
  }
1750
1751
  function stringifyEvent(routerEvent) {
@@ -1854,10 +1855,10 @@ class ChildrenOutletContexts {
1854
1855
  getContext(childName) {
1855
1856
  return this.contexts.get(childName) || null;
1856
1857
  }
1857
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1858
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' }); }
1858
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1859
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' }); }
1859
1860
  }
1860
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
1861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
1861
1862
  type: Injectable,
1862
1863
  args: [{ providedIn: 'root' }]
1863
1864
  }] });
@@ -2569,10 +2570,10 @@ class RouterOutlet {
2569
2570
  this.inputBinder?.bindActivatedRouteToOutletComponent(this);
2570
2571
  this.activateEvents.emit(this.activated.instance);
2571
2572
  }
2572
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2573
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 }); }
2573
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2574
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.0-next.1", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 }); }
2574
2575
  }
2575
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterOutlet, decorators: [{
2576
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterOutlet, decorators: [{
2576
2577
  type: Directive,
2577
2578
  args: [{
2578
2579
  selector: 'router-outlet',
@@ -2677,10 +2678,10 @@ class RoutedComponentInputBinder {
2677
2678
  });
2678
2679
  this.outletDataSubscriptions.set(outlet, dataSubscription);
2679
2680
  }
2680
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RoutedComponentInputBinder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2681
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RoutedComponentInputBinder }); }
2681
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RoutedComponentInputBinder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2682
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RoutedComponentInputBinder }); }
2682
2683
  }
2683
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RoutedComponentInputBinder, decorators: [{
2684
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RoutedComponentInputBinder, decorators: [{
2684
2685
  type: Injectable
2685
2686
  }] });
2686
2687
 
@@ -2760,10 +2761,10 @@ function isNavigationCancelingError(error) {
2760
2761
  * to this `EmptyOutletComponent`.
2761
2762
  */
2762
2763
  class ɵEmptyOutletComponent {
2763
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2764
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
2764
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2765
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.0-next.1", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
2765
2766
  }
2766
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2767
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2767
2768
  type: Component,
2768
2769
  args: [{
2769
2770
  template: `<router-outlet></router-outlet>`,
@@ -3330,6 +3331,22 @@ function isEmptyError(e) {
3330
3331
  return e instanceof EmptyError || e?.name === 'EmptyError';
3331
3332
  }
3332
3333
 
3334
+ /**
3335
+ * Can be returned by a `Router` guard to instruct the `Router` to redirect rather than continue
3336
+ * processing the path of the in-flight navigation. The `redirectTo` indicates _where_ the new
3337
+ * navigation should go to and the optional `navigationBehaviorOptions` can provide more information
3338
+ * about _how_ to perform the navigation.
3339
+ *
3340
+ * @see [Routing tutorial](guide/router-tutorial-toh#milestone-5-route-guards)
3341
+ * @publicApi
3342
+ */
3343
+ class RedirectCommand {
3344
+ constructor(redirectTo, navigationBehaviorOptions) {
3345
+ this.redirectTo = redirectTo;
3346
+ this.navigationBehaviorOptions = navigationBehaviorOptions;
3347
+ }
3348
+ }
3349
+
3333
3350
  const INITIAL_VALUE = /* @__PURE__ */ Symbol('INITIAL_VALUE');
3334
3351
  function prioritizedGuardValue() {
3335
3352
  return switchMap((obs) => {
@@ -3343,9 +3360,9 @@ function prioritizedGuardValue() {
3343
3360
  // If guard has not finished, we need to stop processing.
3344
3361
  return INITIAL_VALUE;
3345
3362
  }
3346
- else if (result === false || result instanceof UrlTree) {
3363
+ else if (result === false || isRedirect(result)) {
3347
3364
  // Result finished and was not true. Return the result.
3348
- // Note that we only allow false/UrlTree. Other values are considered invalid and
3365
+ // Note that we only allow false/UrlTree/RedirectCommand. Other values are considered invalid and
3349
3366
  // ignored.
3350
3367
  return result;
3351
3368
  }
@@ -3355,6 +3372,9 @@ function prioritizedGuardValue() {
3355
3372
  }), filter((item) => item !== INITIAL_VALUE), take(1));
3356
3373
  });
3357
3374
  }
3375
+ function isRedirect(val) {
3376
+ return isUrlTree(val) || val instanceof RedirectCommand;
3377
+ }
3358
3378
 
3359
3379
  function checkGuards(injector, forwardEvent) {
3360
3380
  return mergeMap((t) => {
@@ -3477,7 +3497,7 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3477
3497
  }
3478
3498
  function redirectIfUrlTree(urlSerializer) {
3479
3499
  return pipe(tap((result) => {
3480
- if (!isUrlTree(result))
3500
+ if (typeof result === 'boolean')
3481
3501
  return;
3482
3502
  throw redirectingNavigationError(urlSerializer, result);
3483
3503
  }), map((result) => result === true));
@@ -3535,14 +3555,23 @@ class ApplyRedirects {
3535
3555
  return of(res);
3536
3556
  }
3537
3557
  if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
3538
- return namedOutletsRedirect(route.redirectTo);
3558
+ return namedOutletsRedirect(`${route.redirectTo}`);
3539
3559
  }
3540
3560
  c = c.children[PRIMARY_OUTLET];
3541
3561
  }
3542
3562
  }
3543
- applyRedirectCommands(segments, redirectTo, posParams) {
3563
+ applyRedirectCommands(segments, redirectTo, posParams, currentSnapshot, injector) {
3564
+ if (typeof redirectTo !== 'string') {
3565
+ const redirectToFn = redirectTo;
3566
+ const { queryParams, fragment, routeConfig, url, outlet, params, data, title } = currentSnapshot;
3567
+ const newRedirect = runInInjectionContext(injector, () => redirectToFn({ params, data, queryParams, fragment, routeConfig, url, outlet, title }));
3568
+ if (newRedirect instanceof UrlTree) {
3569
+ throw new AbsoluteRedirect(newRedirect);
3570
+ }
3571
+ redirectTo = newRedirect;
3572
+ }
3544
3573
  const newTree = this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3545
- if (redirectTo.startsWith('/')) {
3574
+ if (redirectTo[0] === '/') {
3546
3575
  throw new AbsoluteRedirect(newTree);
3547
3576
  }
3548
3577
  return newTree;
@@ -3554,7 +3583,7 @@ class ApplyRedirects {
3554
3583
  createQueryParams(redirectToParams, actualParams) {
3555
3584
  const res = {};
3556
3585
  Object.entries(redirectToParams).forEach(([k, v]) => {
3557
- const copySourceValue = typeof v === 'string' && v.startsWith(':');
3586
+ const copySourceValue = typeof v === 'string' && v[0] === ':';
3558
3587
  if (copySourceValue) {
3559
3588
  const sourceName = v.substring(1);
3560
3589
  res[k] = actualParams[sourceName];
@@ -3574,7 +3603,7 @@ class ApplyRedirects {
3574
3603
  return new UrlSegmentGroup(updatedSegments, children);
3575
3604
  }
3576
3605
  createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
3577
- return redirectToSegments.map((s) => s.path.startsWith(':')
3606
+ return redirectToSegments.map((s) => s.path[0] === ':'
3578
3607
  ? this.findPosParam(redirectTo, s, posParams)
3579
3608
  : this.findOrReturn(s, actualSegments));
3580
3609
  }
@@ -3765,25 +3794,25 @@ class Recognizer {
3765
3794
  }
3766
3795
  recognize() {
3767
3796
  const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
3768
- return this.match(rootSegmentGroup).pipe(map((children) => {
3769
- // Use Object.freeze to prevent readers of the Router state from modifying it outside
3770
- // of a navigation, resulting in the router being out of sync with the browser.
3771
- const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, {});
3772
- const rootNode = new TreeNode(root, children);
3797
+ return this.match(rootSegmentGroup).pipe(map(({ children, rootSnapshot }) => {
3798
+ const rootNode = new TreeNode(rootSnapshot, children);
3773
3799
  const routeState = new RouterStateSnapshot('', rootNode);
3774
- const tree = createUrlTreeFromSnapshot(root, [], this.urlTree.queryParams, this.urlTree.fragment);
3800
+ const tree = createUrlTreeFromSnapshot(rootSnapshot, [], this.urlTree.queryParams, this.urlTree.fragment);
3775
3801
  // https://github.com/angular/angular/issues/47307
3776
3802
  // Creating the tree stringifies the query params
3777
3803
  // We don't want to do this here so reassign them to the original.
3778
3804
  tree.queryParams = this.urlTree.queryParams;
3779
3805
  routeState.url = this.urlSerializer.serialize(tree);
3780
- this.inheritParamsAndData(routeState._root, null);
3781
3806
  return { state: routeState, tree };
3782
3807
  }));
3783
3808
  }
3784
3809
  match(rootSegmentGroup) {
3785
- const expanded$ = this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET);
3786
- return expanded$.pipe(catchError((e) => {
3810
+ // Use Object.freeze to prevent readers of the Router state from modifying it outside
3811
+ // of a navigation, resulting in the router being out of sync with the browser.
3812
+ const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});
3813
+ return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot).pipe(map((children) => {
3814
+ return { children, rootSnapshot };
3815
+ }), catchError((e) => {
3787
3816
  if (e instanceof AbsoluteRedirect) {
3788
3817
  this.urlTree = e.urlTree;
3789
3818
  return this.match(e.urlTree.root);
@@ -3794,18 +3823,11 @@ class Recognizer {
3794
3823
  throw e;
3795
3824
  }));
3796
3825
  }
3797
- inheritParamsAndData(routeNode, parent) {
3798
- const route = routeNode.value;
3799
- const i = getInherited(route, parent, this.paramsInheritanceStrategy);
3800
- route.params = Object.freeze(i.params);
3801
- route.data = Object.freeze(i.data);
3802
- routeNode.children.forEach((n) => this.inheritParamsAndData(n, route));
3803
- }
3804
- processSegmentGroup(injector, config, segmentGroup, outlet) {
3826
+ processSegmentGroup(injector, config, segmentGroup, outlet, parentRoute) {
3805
3827
  if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
3806
- return this.processChildren(injector, config, segmentGroup);
3828
+ return this.processChildren(injector, config, segmentGroup, parentRoute);
3807
3829
  }
3808
- return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true).pipe(map((child) => (child instanceof TreeNode ? [child] : [])));
3830
+ return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true, parentRoute).pipe(map((child) => (child instanceof TreeNode ? [child] : [])));
3809
3831
  }
3810
3832
  /**
3811
3833
  * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if
@@ -3815,7 +3837,7 @@ class Recognizer {
3815
3837
  * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the
3816
3838
  * config.
3817
3839
  */
3818
- processChildren(injector, config, segmentGroup) {
3840
+ processChildren(injector, config, segmentGroup, parentRoute) {
3819
3841
  // Expand outlets one at a time, starting with the primary outlet. We need to do it this way
3820
3842
  // because an absolute redirect from the primary outlet takes precedence.
3821
3843
  const childOutlets = [];
@@ -3833,7 +3855,7 @@ class Recognizer {
3833
3855
  // appear first, followed by routes for other outlets, which might match if they have
3834
3856
  // an empty path.
3835
3857
  const sortedConfig = sortByMatchingOutlets(config, childOutlet);
3836
- return this.processSegmentGroup(injector, sortedConfig, child, childOutlet);
3858
+ return this.processSegmentGroup(injector, sortedConfig, child, childOutlet, parentRoute);
3837
3859
  }), scan((children, outletChildren) => {
3838
3860
  children.push(...outletChildren);
3839
3861
  return children;
@@ -3853,9 +3875,9 @@ class Recognizer {
3853
3875
  return of(mergedChildren);
3854
3876
  }));
3855
3877
  }
3856
- processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects) {
3878
+ processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects, parentRoute) {
3857
3879
  return from(routes).pipe(concatMap((r) => {
3858
- return this.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects).pipe(catchError((e) => {
3880
+ return this.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects, parentRoute).pipe(catchError((e) => {
3859
3881
  if (e instanceof NoMatch) {
3860
3882
  return of(null);
3861
3883
  }
@@ -3871,24 +3893,24 @@ class Recognizer {
3871
3893
  throw e;
3872
3894
  }));
3873
3895
  }
3874
- processSegmentAgainstRoute(injector, routes, route, rawSegment, segments, outlet, allowRedirects) {
3896
+ processSegmentAgainstRoute(injector, routes, route, rawSegment, segments, outlet, allowRedirects, parentRoute) {
3875
3897
  if (!isImmediateMatch(route, rawSegment, segments, outlet))
3876
3898
  return noMatch$1(rawSegment);
3877
3899
  if (route.redirectTo === undefined) {
3878
- return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet);
3900
+ return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute);
3879
3901
  }
3880
3902
  if (this.allowRedirects && allowRedirects) {
3881
- return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes, route, segments, outlet);
3903
+ return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes, route, segments, outlet, parentRoute);
3882
3904
  }
3883
3905
  return noMatch$1(rawSegment);
3884
3906
  }
3885
- expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet) {
3886
- const { matched, consumedSegments, positionalParamSegments, remainingSegments } = match(segmentGroup, route, segments);
3907
+ expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet, parentRoute) {
3908
+ const { matched, parameters, consumedSegments, positionalParamSegments, remainingSegments } = match(segmentGroup, route, segments);
3887
3909
  if (!matched)
3888
3910
  return noMatch$1(segmentGroup);
3889
3911
  // TODO(atscott): Move all of this under an if(ngDevMode) as a breaking change and allow stack
3890
3912
  // size exceeded in production
3891
- if (route.redirectTo.startsWith('/')) {
3913
+ if (typeof route.redirectTo === 'string' && route.redirectTo[0] === '/') {
3892
3914
  this.absoluteRedirectCount++;
3893
3915
  if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) {
3894
3916
  if (ngDevMode) {
@@ -3899,12 +3921,16 @@ class Recognizer {
3899
3921
  this.allowRedirects = false;
3900
3922
  }
3901
3923
  }
3902
- const newTree = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
3924
+ const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
3925
+ const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);
3926
+ currentSnapshot.params = Object.freeze(inherited.params);
3927
+ currentSnapshot.data = Object.freeze(inherited.data);
3928
+ const newTree = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments, currentSnapshot, injector);
3903
3929
  return this.applyRedirects.lineralizeSegments(route, newTree).pipe(mergeMap((newSegments) => {
3904
- return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false);
3930
+ return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false, parentRoute);
3905
3931
  }));
3906
3932
  }
3907
- matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet) {
3933
+ matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute) {
3908
3934
  const matchResult = matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer);
3909
3935
  if (route.path === '**') {
3910
3936
  // Prior versions of the route matching algorithm would stop matching at the wildcard route.
@@ -3921,14 +3947,14 @@ class Recognizer {
3921
3947
  injector = route._injector ?? injector;
3922
3948
  return this.getChildConfig(injector, route, segments).pipe(switchMap(({ routes: childConfig }) => {
3923
3949
  const childInjector = route._loadedInjector ?? injector;
3924
- const { consumedSegments, remainingSegments, parameters } = result;
3950
+ const { parameters, consumedSegments, remainingSegments } = result;
3925
3951
  const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
3952
+ const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);
3953
+ snapshot.params = Object.freeze(inherited.params);
3954
+ snapshot.data = Object.freeze(inherited.data);
3926
3955
  const { segmentGroup, slicedSegments } = split(rawSegment, consumedSegments, remainingSegments, childConfig);
3927
3956
  if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
3928
- return this.processChildren(childInjector, childConfig, segmentGroup).pipe(map((children) => {
3929
- if (children === null) {
3930
- return null;
3931
- }
3957
+ return this.processChildren(childInjector, childConfig, segmentGroup, snapshot).pipe(map((children) => {
3932
3958
  return new TreeNode(snapshot, children);
3933
3959
  }));
3934
3960
  }
@@ -3944,7 +3970,7 @@ class Recognizer {
3944
3970
  // {path: 'c', component: C},
3945
3971
  // ]}
3946
3972
  // Notice that the children of the named outlet are configured with the primary outlet
3947
- return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true).pipe(map((child) => {
3973
+ return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true, snapshot).pipe(map((child) => {
3948
3974
  return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);
3949
3975
  }));
3950
3976
  }));
@@ -4174,10 +4200,10 @@ class TitleStrategy {
4174
4200
  getResolvedTitleForRoute(snapshot) {
4175
4201
  return snapshot.data[RouteTitleKey];
4176
4202
  }
4177
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4178
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }); }
4203
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4204
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }); }
4179
4205
  }
4180
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: TitleStrategy, decorators: [{
4206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: TitleStrategy, decorators: [{
4181
4207
  type: Injectable,
4182
4208
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4183
4209
  }] });
@@ -4200,10 +4226,10 @@ class DefaultTitleStrategy extends TitleStrategy {
4200
4226
  this.title.setTitle(title);
4201
4227
  }
4202
4228
  }
4203
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable }); }
4204
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' }); }
4229
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable }); }
4230
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' }); }
4205
4231
  }
4206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4232
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4207
4233
  type: Injectable,
4208
4234
  args: [{ providedIn: 'root' }]
4209
4235
  }], ctorParameters: () => [{ type: i1.Title }] });
@@ -4279,10 +4305,10 @@ class RouterConfigLoader {
4279
4305
  this.childrenLoaders.set(route, loader);
4280
4306
  return loader;
4281
4307
  }
4282
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterConfigLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4283
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' }); }
4308
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterConfigLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4309
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' }); }
4284
4310
  }
4285
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4311
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4286
4312
  type: Injectable,
4287
4313
  args: [{ providedIn: 'root' }]
4288
4314
  }] });
@@ -4349,10 +4375,10 @@ function maybeUnwrapDefaultExport(input) {
4349
4375
  * @publicApi
4350
4376
  */
4351
4377
  class UrlHandlingStrategy {
4352
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4353
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }); }
4378
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4379
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }); }
4354
4380
  }
4355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4381
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4356
4382
  type: Injectable,
4357
4383
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4358
4384
  }] });
@@ -4369,10 +4395,10 @@ class DefaultUrlHandlingStrategy {
4369
4395
  merge(newUrlPart, wholeUrl) {
4370
4396
  return newUrlPart;
4371
4397
  }
4372
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4373
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' }); }
4398
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4399
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' }); }
4374
4400
  }
4375
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4376
4402
  type: Injectable,
4377
4403
  args: [{ providedIn: 'root' }]
4378
4404
  }] });
@@ -4615,7 +4641,7 @@ class NavigationTransitions {
4615
4641
  return overallTransitionState;
4616
4642
  }), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap((t) => {
4617
4643
  overallTransitionState.guardsResult = t.guardsResult;
4618
- if (isUrlTree(t.guardsResult)) {
4644
+ if (t.guardsResult && typeof t.guardsResult !== 'boolean') {
4619
4645
  throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4620
4646
  }
4621
4647
  const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
@@ -4738,7 +4764,7 @@ class NavigationTransitions {
4738
4764
  overallTransitionState.resolve(false);
4739
4765
  }
4740
4766
  else {
4741
- this.events.next(new RedirectRequest(e.url));
4767
+ this.events.next(new RedirectRequest(e.url, e.navigationBehaviorOptions));
4742
4768
  }
4743
4769
  /* All other errors should reset to the router's internal URL reference
4744
4770
  * to the pre-error state. */
@@ -4803,10 +4829,10 @@ class NavigationTransitions {
4803
4829
  return (extractedBrowserUrl.toString() !== this.currentTransition?.extractedUrl.toString() &&
4804
4830
  !this.currentTransition?.extras.skipLocationChange);
4805
4831
  }
4806
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4807
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NavigationTransitions, providedIn: 'root' }); }
4832
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4833
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: NavigationTransitions, providedIn: 'root' }); }
4808
4834
  }
4809
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NavigationTransitions, decorators: [{
4835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: NavigationTransitions, decorators: [{
4810
4836
  type: Injectable,
4811
4837
  args: [{ providedIn: 'root' }]
4812
4838
  }], ctorParameters: () => [] });
@@ -4822,10 +4848,10 @@ function isBrowserTriggeredNavigation(source) {
4822
4848
  * @publicApi
4823
4849
  */
4824
4850
  class RouteReuseStrategy {
4825
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4826
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }); }
4851
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4852
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }); }
4827
4853
  }
4828
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4854
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4829
4855
  type: Injectable,
4830
4856
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4831
4857
  }] });
@@ -4876,19 +4902,19 @@ class BaseRouteReuseStrategy {
4876
4902
  }
4877
4903
  }
4878
4904
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4879
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
4880
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' }); }
4905
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
4906
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' }); }
4881
4907
  }
4882
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4908
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4883
4909
  type: Injectable,
4884
4910
  args: [{ providedIn: 'root' }]
4885
4911
  }] });
4886
4912
 
4887
4913
  class StateManager {
4888
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: StateManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4889
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: StateManager, providedIn: 'root', useFactory: () => inject(HistoryStateManager) }); }
4914
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: StateManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4915
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: StateManager, providedIn: 'root', useFactory: () => inject(HistoryStateManager) }); }
4890
4916
  }
4891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: StateManager, decorators: [{
4917
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: StateManager, decorators: [{
4892
4918
  type: Injectable,
4893
4919
  args: [{ providedIn: 'root', useFactory: () => inject(HistoryStateManager) }]
4894
4920
  }] });
@@ -5063,10 +5089,10 @@ class HistoryStateManager extends StateManager {
5063
5089
  }
5064
5090
  return { navigationId };
5065
5091
  }
5066
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: HistoryStateManager, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
5067
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: HistoryStateManager, providedIn: 'root' }); }
5092
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: HistoryStateManager, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
5093
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: HistoryStateManager, providedIn: 'root' }); }
5068
5094
  }
5069
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: HistoryStateManager, decorators: [{
5095
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: HistoryStateManager, decorators: [{
5070
5096
  type: Injectable,
5071
5097
  args: [{ providedIn: 'root' }]
5072
5098
  }] });
@@ -5251,6 +5277,7 @@ class Router {
5251
5277
  this.navigated = true;
5252
5278
  }
5253
5279
  else if (e instanceof RedirectRequest) {
5280
+ const opts = e.navigationBehaviorOptions;
5254
5281
  const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);
5255
5282
  const extras = {
5256
5283
  // Persist transient navigation info from the original navigation request.
@@ -5262,6 +5289,8 @@ class Router {
5262
5289
  // if the navigation is rejected.
5263
5290
  replaceUrl: this.urlUpdateStrategy === 'eager' ||
5264
5291
  isBrowserTriggeredNavigation(currentTransition.source),
5292
+ // allow developer to override default options with RedirectCommand
5293
+ ...opts,
5265
5294
  };
5266
5295
  this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras, {
5267
5296
  resolve: currentTransition.resolve,
@@ -5476,7 +5505,7 @@ class Router {
5476
5505
  // Note: the difference between having this fallback for invalid `ActivatedRoute` setups and
5477
5506
  // just throwing is ~500 test failures. Fixing all of those tests by hand is not feasible at
5478
5507
  // the moment.
5479
- if (typeof commands[0] !== 'string' || !commands[0].startsWith('/')) {
5508
+ if (typeof commands[0] !== 'string' || commands[0][0] !== '/') {
5480
5509
  // Navigations that were absolute in the old way of creating UrlTrees
5481
5510
  // would still work because they wouldn't attempt to match the
5482
5511
  // segments in the `ActivatedRoute` to the `currentUrlTree` but
@@ -5642,10 +5671,10 @@ class Router {
5642
5671
  return Promise.reject(e);
5643
5672
  });
5644
5673
  }
5645
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5646
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Router, providedIn: 'root' }); }
5674
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5675
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: Router, providedIn: 'root' }); }
5647
5676
  }
5648
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Router, decorators: [{
5677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: Router, decorators: [{
5649
5678
  type: Injectable,
5650
5679
  args: [{ providedIn: 'root' }]
5651
5680
  }], ctorParameters: () => [] });
@@ -5920,10 +5949,10 @@ class RouterLink {
5920
5949
  preserveFragment: this.preserveFragment,
5921
5950
  });
5922
5951
  }
5923
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive }); }
5924
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.1", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", info: "info", relativeTo: "relativeTo", preserveFragment: ["preserveFragment", "preserveFragment", booleanAttribute], skipLocationChange: ["skipLocationChange", "skipLocationChange", booleanAttribute], replaceUrl: ["replaceUrl", "replaceUrl", booleanAttribute], routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 }); }
5952
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive }); }
5953
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.0-next.1", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", info: "info", relativeTo: "relativeTo", preserveFragment: ["preserveFragment", "preserveFragment", booleanAttribute], skipLocationChange: ["skipLocationChange", "skipLocationChange", booleanAttribute], replaceUrl: ["replaceUrl", "replaceUrl", booleanAttribute], routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 }); }
5925
5954
  }
5926
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterLink, decorators: [{
5955
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterLink, decorators: [{
5927
5956
  type: Directive,
5928
5957
  args: [{
5929
5958
  selector: '[routerLink]',
@@ -6160,10 +6189,10 @@ class RouterLinkActive {
6160
6189
  const isActiveCheckFn = this.isLinkActive(this.router);
6161
6190
  return (this.link && isActiveCheckFn(this.link)) || this.links.some(isActiveCheckFn);
6162
6191
  }
6163
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
6164
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 }); }
6192
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
6193
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.0-next.1", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 }); }
6165
6194
  }
6166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterLinkActive, decorators: [{
6195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterLinkActive, decorators: [{
6167
6196
  type: Directive,
6168
6197
  args: [{
6169
6198
  selector: '[routerLinkActive]',
@@ -6215,10 +6244,10 @@ class PreloadAllModules {
6215
6244
  preload(route, fn) {
6216
6245
  return fn().pipe(catchError(() => of(null)));
6217
6246
  }
6218
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6219
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' }); }
6247
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6248
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' }); }
6220
6249
  }
6221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6250
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6222
6251
  type: Injectable,
6223
6252
  args: [{ providedIn: 'root' }]
6224
6253
  }] });
@@ -6235,10 +6264,10 @@ class NoPreloading {
6235
6264
  preload(route, fn) {
6236
6265
  return of(null);
6237
6266
  }
6238
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6239
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NoPreloading, providedIn: 'root' }); }
6267
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6268
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: NoPreloading, providedIn: 'root' }); }
6240
6269
  }
6241
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NoPreloading, decorators: [{
6270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: NoPreloading, decorators: [{
6242
6271
  type: Injectable,
6243
6272
  args: [{ providedIn: 'root' }]
6244
6273
  }] });
@@ -6329,10 +6358,10 @@ class RouterPreloader {
6329
6358
  }
6330
6359
  });
6331
6360
  }
6332
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
6333
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' }); }
6361
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
6362
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' }); }
6334
6363
  }
6335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterPreloader, decorators: [{
6364
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterPreloader, decorators: [{
6336
6365
  type: Injectable,
6337
6366
  args: [{ providedIn: 'root' }]
6338
6367
  }], ctorParameters: () => [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }] });
@@ -6425,10 +6454,10 @@ class RouterScroller {
6425
6454
  this.routerEventsSubscription?.unsubscribe();
6426
6455
  this.scrollEventsSubscription?.unsubscribe();
6427
6456
  }
6428
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable }); }
6429
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterScroller }); }
6457
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable }); }
6458
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterScroller }); }
6430
6459
  }
6431
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterScroller, decorators: [{
6460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterScroller, decorators: [{
6432
6461
  type: Injectable
6433
6462
  }], ctorParameters: () => [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }] });
6434
6463
 
@@ -7078,11 +7107,11 @@ class RouterModule {
7078
7107
  providers: [{ provide: ROUTES, multi: true, useValue: routes }],
7079
7108
  };
7080
7109
  }
7081
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
7082
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.1", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] }); }
7083
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterModule }); }
7110
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
7111
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] }); }
7112
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterModule }); }
7084
7113
  }
7085
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RouterModule, decorators: [{
7114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-next.1", ngImport: i0, type: RouterModule, decorators: [{
7086
7115
  type: NgModule,
7087
7116
  args: [{
7088
7117
  imports: ROUTER_DIRECTIVES,
@@ -7227,7 +7256,7 @@ function mapToResolve(provider) {
7227
7256
  /**
7228
7257
  * @publicApi
7229
7258
  */
7230
- const VERSION = new Version('17.3.1');
7259
+ const VERSION = new Version('18.0.0-next.1');
7231
7260
 
7232
7261
  /**
7233
7262
  * @module
@@ -7242,5 +7271,5 @@ const VERSION = new Version('17.3.1');
7242
7271
  * Generated bundle index. Do not edit.
7243
7272
  */
7244
7273
 
7245
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };
7274
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };
7246
7275
  //# sourceMappingURL=router.mjs.map