@angular/router 14.1.0 → 14.2.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 (38) hide show
  1. package/esm2020/src/apply_redirects.mjs +4 -3
  2. package/esm2020/src/components/empty_outlet.mjs +10 -6
  3. package/esm2020/src/directives/router_link.mjs +12 -9
  4. package/esm2020/src/directives/router_link_active.mjs +5 -4
  5. package/esm2020/src/directives/router_outlet.mjs +9 -5
  6. package/esm2020/src/index.mjs +4 -3
  7. package/esm2020/src/models.mjs +1 -1
  8. package/esm2020/src/operators/check_guards.mjs +36 -26
  9. package/esm2020/src/operators/resolve_data.mjs +22 -23
  10. package/esm2020/src/page_title_strategy.mjs +9 -10
  11. package/esm2020/src/private_export.mjs +3 -2
  12. package/esm2020/src/recognize.mjs +4 -3
  13. package/esm2020/src/router.mjs +62 -9
  14. package/esm2020/src/router_config.mjs +19 -0
  15. package/esm2020/src/router_config_loader.mjs +6 -5
  16. package/esm2020/src/router_module.mjs +22 -79
  17. package/esm2020/src/router_outlet_context.mjs +9 -1
  18. package/esm2020/src/router_preloader.mjs +19 -11
  19. package/esm2020/src/router_scroller.mjs +3 -3
  20. package/esm2020/src/router_state.mjs +7 -3
  21. package/esm2020/src/shared.mjs +22 -2
  22. package/esm2020/src/url_tree.mjs +9 -2
  23. package/esm2020/src/utils/preactivation.mjs +16 -6
  24. package/esm2020/src/utils/type_guards.mjs +5 -1
  25. package/esm2020/src/version.mjs +1 -1
  26. package/esm2020/testing/src/router_testing_module.mjs +4 -4
  27. package/fesm2015/router.mjs +381 -277
  28. package/fesm2015/router.mjs.map +1 -1
  29. package/fesm2015/testing.mjs +5 -5
  30. package/fesm2015/upgrade.mjs +1 -1
  31. package/fesm2020/router.mjs +365 -275
  32. package/fesm2020/router.mjs.map +1 -1
  33. package/fesm2020/testing.mjs +5 -5
  34. package/fesm2020/upgrade.mjs +1 -1
  35. package/index.d.ts +119 -77
  36. package/package.json +4 -4
  37. package/testing/index.d.ts +1 -1
  38. package/upgrade/index.d.ts +1 -1
@@ -1,14 +1,14 @@
1
1
  /**
2
- * @license Angular v14.1.0
2
+ * @license Angular v14.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵisObservable, ɵisPromise, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, inject, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
9
- import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
8
+ import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, NgProbeToken, SkipSelf, NgModule, Inject, ApplicationRef, APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
9
+ import { from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import * as i3 from '@angular/common';
11
- import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
11
+ import { Location, ViewportScroller, LocationStrategy, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
12
12
  import { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
13
13
  import * as i1 from '@angular/platform-browser';
14
14
 
@@ -25,6 +25,12 @@ import * as i1 from '@angular/platform-browser';
25
25
  * @publicApi
26
26
  */
27
27
  const PRIMARY_OUTLET = 'primary';
28
+ /**
29
+ * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
30
+ * static string or `Route.resolve` if anything else. This allows us to reuse the existing route
31
+ * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
32
+ */
33
+ const RouteTitleKey = Symbol('RouteTitle');
28
34
  class ParamsAsMap {
29
35
  constructor(params) {
30
36
  this.params = params || {};
@@ -60,7 +66,21 @@ class ParamsAsMap {
60
66
  function convertToParamMap(params) {
61
67
  return new ParamsAsMap(params);
62
68
  }
63
- // Matches the route configuration (`route`) against the actual URL (`segments`).
69
+ /**
70
+ * Matches the route configuration (`route`) against the actual URL (`segments`).
71
+ *
72
+ * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.
73
+ *
74
+ * @param segments The remaining unmatched segments in the current navigation
75
+ * @param segmentGroup The current segment group being matched
76
+ * @param route The `Route` to match against.
77
+ *
78
+ * @see UrlMatchResult
79
+ * @see Route
80
+ *
81
+ * @returns The resulting match information or `null` if the `route` should not match.
82
+ * @publicApi
83
+ */
64
84
  function defaultUrlMatcher(segments, segmentGroup, route) {
65
85
  const parts = route.path.split('/');
66
86
  if (parts.length > segments.length) {
@@ -182,7 +202,7 @@ function wrapIntoObservable(value) {
182
202
  * Use of this source code is governed by an MIT-style license that can be
183
203
  * found in the LICENSE file at https://angular.io/license
184
204
  */
185
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
205
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
186
206
  function createEmptyUrlTree() {
187
207
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
188
208
  }
@@ -439,6 +459,12 @@ function mapChildrenIntoArray(segment, fn) {
439
459
  */
440
460
  class UrlSerializer {
441
461
  }
462
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
463
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: UrlSerializer, decorators: [{
465
+ type: Injectable,
466
+ args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
467
+ }] });
442
468
  /**
443
469
  * @description
444
470
  *
@@ -647,7 +673,7 @@ class UrlParser {
647
673
  parseSegment() {
648
674
  const path = matchSegments(this.remaining);
649
675
  if (path === '' && this.peekStartsWith(';')) {
650
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
676
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
651
677
  }
652
678
  this.capture(path);
653
679
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -716,7 +742,7 @@ class UrlParser {
716
742
  // if is is not one of these characters, then the segment was unescaped
717
743
  // or the group was not closed
718
744
  if (next !== '/' && next !== ')' && next !== ';') {
719
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
745
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
720
746
  }
721
747
  let outletName = undefined;
722
748
  if (path.indexOf(':') > -1) {
@@ -747,7 +773,7 @@ class UrlParser {
747
773
  }
748
774
  capture(str) {
749
775
  if (!this.consumeOptional(str)) {
750
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
776
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
751
777
  }
752
778
  }
753
779
  }
@@ -800,7 +826,7 @@ function isUrlTree(v) {
800
826
  * Use of this source code is governed by an MIT-style license that can be
801
827
  * found in the LICENSE file at https://angular.io/license
802
828
  */
803
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
829
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
804
830
  /**
805
831
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
806
832
  *
@@ -976,11 +1002,11 @@ class Navigation {
976
1002
  this.numberOfDoubleDots = numberOfDoubleDots;
977
1003
  this.commands = commands;
978
1004
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
979
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
1005
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
980
1006
  }
981
1007
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
982
1008
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
983
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
1009
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
984
1010
  }
985
1011
  }
986
1012
  toRoot() {
@@ -1079,7 +1105,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1079
1105
  dd -= ci;
1080
1106
  g = g.parent;
1081
1107
  if (!g) {
1082
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1108
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
1083
1109
  }
1084
1110
  ci = g.segments.length;
1085
1111
  }
@@ -1909,6 +1935,8 @@ class ActivatedRoute {
1909
1935
  this.data = data;
1910
1936
  this.outlet = outlet;
1911
1937
  this.component = component;
1938
+ /** An Observable of the resolved route title */
1939
+ this.title = this.data?.pipe(map((d) => d[RouteTitleKey])) ?? of(undefined);
1912
1940
  this._futureSnapshot = futureSnapshot;
1913
1941
  }
1914
1942
  /** The configuration used to match this route. */
@@ -2063,6 +2091,8 @@ class ActivatedRouteSnapshot {
2063
2091
  this.data = data;
2064
2092
  this.outlet = outlet;
2065
2093
  this.component = component;
2094
+ /** The resolved route title */
2095
+ this.title = this.data?.[RouteTitleKey];
2066
2096
  this.routeConfig = routeConfig;
2067
2097
  this._urlSegment = urlSegment;
2068
2098
  this._lastPathIndex = lastPathIndex;
@@ -2352,6 +2382,12 @@ class ChildrenOutletContexts {
2352
2382
  return this.contexts.get(childName) || null;
2353
2383
  }
2354
2384
  }
2385
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2386
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2388
+ type: Injectable,
2389
+ args: [{ providedIn: 'root' }]
2390
+ }] });
2355
2391
 
2356
2392
  /**
2357
2393
  * @license
@@ -2360,7 +2396,7 @@ class ChildrenOutletContexts {
2360
2396
  * Use of this source code is governed by an MIT-style license that can be
2361
2397
  * found in the LICENSE file at https://angular.io/license
2362
2398
  */
2363
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2399
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2364
2400
  /**
2365
2401
  * @description
2366
2402
  *
@@ -2469,12 +2505,12 @@ class RouterOutlet {
2469
2505
  */
2470
2506
  get component() {
2471
2507
  if (!this.activated)
2472
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2508
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2473
2509
  return this.activated.instance;
2474
2510
  }
2475
2511
  get activatedRoute() {
2476
2512
  if (!this.activated)
2477
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2513
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2478
2514
  return this._activatedRoute;
2479
2515
  }
2480
2516
  get activatedRouteData() {
@@ -2488,7 +2524,7 @@ class RouterOutlet {
2488
2524
  */
2489
2525
  detach() {
2490
2526
  if (!this.activated)
2491
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2527
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2492
2528
  this.location.detach();
2493
2529
  const cmp = this.activated;
2494
2530
  this.activated = null;
@@ -2516,7 +2552,7 @@ class RouterOutlet {
2516
2552
  }
2517
2553
  activateWith(activatedRoute, resolverOrInjector) {
2518
2554
  if (this.isActivated) {
2519
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2555
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
2520
2556
  }
2521
2557
  this._activatedRoute = activatedRoute;
2522
2558
  const location = this.location;
@@ -2538,11 +2574,15 @@ class RouterOutlet {
2538
2574
  this.activateEvents.emit(this.activated.instance);
2539
2575
  }
2540
2576
  }
2541
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2542
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2543
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterOutlet, decorators: [{
2577
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2578
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.1", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterOutlet, decorators: [{
2544
2580
  type: Directive,
2545
- args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2581
+ args: [{
2582
+ selector: 'router-outlet',
2583
+ exportAs: 'outlet',
2584
+ standalone: true,
2585
+ }]
2546
2586
  }], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
2547
2587
  type: Attribute,
2548
2588
  args: ['name']
@@ -2597,11 +2637,15 @@ function isComponentFactoryResolver(item) {
2597
2637
  */
2598
2638
  class ɵEmptyOutletComponent {
2599
2639
  }
2600
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2601
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2602
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2640
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2641
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.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", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2642
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2603
2643
  type: Component,
2604
- args: [{ template: `<router-outlet></router-outlet>` }]
2644
+ args: [{
2645
+ template: `<router-outlet></router-outlet>`,
2646
+ imports: [RouterOutlet],
2647
+ standalone: true,
2648
+ }]
2605
2649
  }] });
2606
2650
 
2607
2651
  /**
@@ -2999,10 +3043,20 @@ function getCanActivateChild(p) {
2999
3043
  return null;
3000
3044
  return { node: p, guards: canActivateChild };
3001
3045
  }
3002
- function getToken(token, snapshot, fallbackInjector) {
3003
- const routeInjector = getClosestRouteInjector(snapshot);
3004
- const injector = routeInjector ?? fallbackInjector;
3005
- return injector.get(token);
3046
+ function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
3047
+ const NOT_FOUND = Symbol();
3048
+ const result = injector.get(tokenOrFunction, NOT_FOUND);
3049
+ if (result === NOT_FOUND) {
3050
+ if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {
3051
+ // We think the token is just a function so return it as-is
3052
+ return tokenOrFunction;
3053
+ }
3054
+ else {
3055
+ // This will throw the not found error
3056
+ return injector.get(tokenOrFunction);
3057
+ }
3058
+ }
3059
+ return result;
3006
3060
  }
3007
3061
  function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
3008
3062
  canDeactivateChecks: [],
@@ -3156,6 +3210,9 @@ function isRedirectingNavigationCancelingError(error) {
3156
3210
  function isNavigationCancelingError(error) {
3157
3211
  return error && error[NAVIGATION_CANCELING_ERROR];
3158
3212
  }
3213
+ function isEmptyError(e) {
3214
+ return e instanceof EmptyError || e?.name === 'EmptyError';
3215
+ }
3159
3216
 
3160
3217
  /**
3161
3218
  * @license
@@ -3198,28 +3255,28 @@ function prioritizedGuardValue() {
3198
3255
  * Use of this source code is governed by an MIT-style license that can be
3199
3256
  * found in the LICENSE file at https://angular.io/license
3200
3257
  */
3201
- function checkGuards(moduleInjector, forwardEvent) {
3258
+ function checkGuards(injector, forwardEvent) {
3202
3259
  return mergeMap(t => {
3203
3260
  const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
3204
3261
  if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
3205
3262
  return of({ ...t, guardsResult: true });
3206
3263
  }
3207
- return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, moduleInjector)
3264
+ return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector)
3208
3265
  .pipe(mergeMap(canDeactivate => {
3209
3266
  return canDeactivate && isBoolean(canDeactivate) ?
3210
- runCanActivateChecks(targetSnapshot, canActivateChecks, moduleInjector, forwardEvent) :
3267
+ runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) :
3211
3268
  of(canDeactivate);
3212
3269
  }), map(guardsResult => ({ ...t, guardsResult })));
3213
3270
  });
3214
3271
  }
3215
- function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) {
3216
- return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector)), first(result => {
3272
+ function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
3273
+ return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {
3217
3274
  return result !== true;
3218
3275
  }, true));
3219
3276
  }
3220
- function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEvent) {
3277
+ function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
3221
3278
  return from(checks).pipe(concatMap((check) => {
3222
- return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, moduleInjector), runCanActivate(futureSnapshot, check.route, moduleInjector));
3279
+ return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
3223
3280
  }), first(result => {
3224
3281
  return result !== true;
3225
3282
  }, true));
@@ -3252,21 +3309,23 @@ function fireChildActivationStart(snapshot, forwardEvent) {
3252
3309
  }
3253
3310
  return of(true);
3254
3311
  }
3255
- function runCanActivate(futureRSS, futureARS, moduleInjector) {
3312
+ function runCanActivate(futureRSS, futureARS, injector) {
3256
3313
  const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
3257
3314
  if (!canActivate || canActivate.length === 0)
3258
3315
  return of(true);
3259
- const canActivateObservables = canActivate.map((c) => {
3316
+ const canActivateObservables = canActivate.map((canActivate) => {
3260
3317
  return defer(() => {
3261
- const guard = getToken(c, futureARS, moduleInjector);
3262
- const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
3263
- guard(futureARS, futureRSS);
3318
+ const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
3319
+ const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
3320
+ const guardVal = isCanActivate(guard) ?
3321
+ guard.canActivate(futureARS, futureRSS) :
3322
+ closestInjector.runInContext(() => guard(futureARS, futureRSS));
3264
3323
  return wrapIntoObservable(guardVal).pipe(first());
3265
3324
  });
3266
3325
  });
3267
3326
  return of(canActivateObservables).pipe(prioritizedGuardValue());
3268
3327
  }
3269
- function runCanActivateChild(futureRSS, path, moduleInjector) {
3328
+ function runCanActivateChild(futureRSS, path, injector) {
3270
3329
  const futureARS = path[path.length - 1];
3271
3330
  const canActivateChildGuards = path.slice(0, path.length - 1)
3272
3331
  .reverse()
@@ -3274,10 +3333,12 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3274
3333
  .filter(_ => _ !== null);
3275
3334
  const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
3276
3335
  return defer(() => {
3277
- const guardsMapped = d.guards.map((c) => {
3278
- const guard = getToken(c, d.node, moduleInjector);
3279
- const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
3280
- guard(futureARS, futureRSS);
3336
+ const guardsMapped = d.guards.map((canActivateChild) => {
3337
+ const closestInjector = getClosestRouteInjector(d.node) ?? injector;
3338
+ const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
3339
+ const guardVal = isCanActivateChild(guard) ?
3340
+ guard.canActivateChild(futureARS, futureRSS) :
3341
+ closestInjector.runInContext(() => guard(futureARS, futureRSS));
3281
3342
  return wrapIntoObservable(guardVal).pipe(first());
3282
3343
  });
3283
3344
  return of(guardsMapped).pipe(prioritizedGuardValue());
@@ -3285,15 +3346,16 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3285
3346
  });
3286
3347
  return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
3287
3348
  }
3288
- function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector) {
3349
+ function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
3289
3350
  const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
3290
3351
  if (!canDeactivate || canDeactivate.length === 0)
3291
3352
  return of(true);
3292
3353
  const canDeactivateObservables = canDeactivate.map((c) => {
3293
- const guard = getToken(c, currARS, moduleInjector);
3354
+ const closestInjector = getClosestRouteInjector(currARS) ?? injector;
3355
+ const guard = getTokenOrFunctionIdentity(c, closestInjector);
3294
3356
  const guardVal = isCanDeactivate(guard) ?
3295
3357
  guard.canDeactivate(component, currARS, currRSS, futureRSS) :
3296
- guard(component, currARS, currRSS, futureRSS);
3358
+ closestInjector.runInContext(() => guard(component, currARS, currRSS, futureRSS));
3297
3359
  return wrapIntoObservable(guardVal).pipe(first());
3298
3360
  });
3299
3361
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
@@ -3304,8 +3366,10 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3304
3366
  return of(true);
3305
3367
  }
3306
3368
  const canLoadObservables = canLoad.map((injectionToken) => {
3307
- const guard = injector.get(injectionToken);
3308
- const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
3369
+ const guard = getTokenOrFunctionIdentity(injectionToken, injector);
3370
+ const guardVal = isCanLoad(guard) ?
3371
+ guard.canLoad(route, segments) :
3372
+ injector.runInContext(() => guard(route, segments));
3309
3373
  return wrapIntoObservable(guardVal);
3310
3374
  });
3311
3375
  return of(canLoadObservables)
@@ -3323,8 +3387,10 @@ function runCanMatchGuards(injector, route, segments, urlSerializer) {
3323
3387
  if (!canMatch || canMatch.length === 0)
3324
3388
  return of(true);
3325
3389
  const canMatchObservables = canMatch.map(injectionToken => {
3326
- const guard = injector.get(injectionToken);
3327
- const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : guard(route, segments);
3390
+ const guard = getTokenOrFunctionIdentity(injectionToken, injector);
3391
+ const guardVal = isCanMatch(guard) ?
3392
+ guard.canMatch(route, segments) :
3393
+ injector.runInContext(() => guard(route, segments));
3328
3394
  return wrapIntoObservable(guardVal);
3329
3395
  });
3330
3396
  return of(canMatchObservables)
@@ -3493,7 +3559,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3493
3559
  * Use of this source code is governed by an MIT-style license that can be
3494
3560
  * found in the LICENSE file at https://angular.io/license
3495
3561
  */
3496
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3562
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3497
3563
  class NoMatch$1 {
3498
3564
  constructor(segmentGroup) {
3499
3565
  this.segmentGroup = segmentGroup || null;
@@ -3511,11 +3577,11 @@ function absoluteRedirect(newTree) {
3511
3577
  return throwError(new AbsoluteRedirect(newTree));
3512
3578
  }
3513
3579
  function namedOutletsRedirect(redirectTo) {
3514
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3580
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
3515
3581
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3516
3582
  }
3517
3583
  function canLoadFails(route) {
3518
- return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3584
+ return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3519
3585
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3520
3586
  }
3521
3587
  /**
@@ -3575,7 +3641,7 @@ class ApplyRedirects {
3575
3641
  }));
3576
3642
  }
3577
3643
  noMatchError(e) {
3578
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3644
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3579
3645
  }
3580
3646
  createUrlTree(rootCandidate, queryParams, fragment) {
3581
3647
  const root = createRoot(rootCandidate);
@@ -3625,7 +3691,7 @@ class ApplyRedirects {
3625
3691
  throw e;
3626
3692
  }));
3627
3693
  }), first((s) => !!s), catchError((e, _) => {
3628
- if (e instanceof EmptyError || e.name === 'EmptyError') {
3694
+ if (isEmptyError(e)) {
3629
3695
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3630
3696
  return of(new UrlSegmentGroup([], {}));
3631
3697
  }
@@ -3790,7 +3856,7 @@ class ApplyRedirects {
3790
3856
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3791
3857
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3792
3858
  if (!pos)
3793
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3859
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3794
3860
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3795
3861
  return pos;
3796
3862
  }
@@ -3826,7 +3892,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3826
3892
  * Use of this source code is governed by an MIT-style license that can be
3827
3893
  * found in the LICENSE file at https://angular.io/license
3828
3894
  */
3829
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3895
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3830
3896
  class NoMatch {
3831
3897
  }
3832
3898
  function newObservableError(e) {
@@ -3915,7 +3981,7 @@ class Recognizer {
3915
3981
  // multiple activated results for the same outlet. We should merge the children of
3916
3982
  // these results so the final return value is only one `TreeNode` per outlet.
3917
3983
  const mergedChildren = mergeEmptyPathMatches(children);
3918
- if (NG_DEV_MODE$3) {
3984
+ if (NG_DEV_MODE$4) {
3919
3985
  // This should really never happen - we are only taking the first match for each
3920
3986
  // outlet and merge the empty path matches.
3921
3987
  checkOutletNameUniqueness(mergedChildren);
@@ -3928,7 +3994,7 @@ class Recognizer {
3928
3994
  return from(routes).pipe(concatMap(r => {
3929
3995
  return this.processSegmentAgainstRoute(r._injector ?? injector, r, segmentGroup, segments, outlet);
3930
3996
  }), first((x) => !!x), catchError(e => {
3931
- if (e instanceof EmptyError) {
3997
+ if (isEmptyError(e)) {
3932
3998
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3933
3999
  return of([]);
3934
4000
  }
@@ -3948,7 +4014,7 @@ class Recognizer {
3948
4014
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3949
4015
  // production bundle size. This value is intended only to surface a warning to users
3950
4016
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3951
- (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
4017
+ (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3952
4018
  pathIndexShift));
3953
4019
  matchResult = of({
3954
4020
  snapshot,
@@ -3964,7 +4030,7 @@ class Recognizer {
3964
4030
  return null;
3965
4031
  }
3966
4032
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3967
- const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ?
4033
+ const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$4 ?
3968
4034
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3969
4035
  pathIndexShift));
3970
4036
  return { snapshot, consumedSegments, remainingSegments };
@@ -4077,7 +4143,7 @@ function checkOutletNameUniqueness(nodes) {
4077
4143
  if (routeWithSameOutletName) {
4078
4144
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4079
4145
  const c = n.value.url.map(s => s.toString()).join('/');
4080
- throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$3 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4146
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$4 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4081
4147
  }
4082
4148
  names[n.value.outlet] = n.value;
4083
4149
  });
@@ -4133,13 +4199,7 @@ function recognize(injector, rootComponentType, config, serializer, paramsInheri
4133
4199
  * Use of this source code is governed by an MIT-style license that can be
4134
4200
  * found in the LICENSE file at https://angular.io/license
4135
4201
  */
4136
- /**
4137
- * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
4138
- * static string or `Route.resolve` if anything else. This allows us to reuse the existing route
4139
- * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
4140
- */
4141
- const RouteTitle = Symbol('RouteTitle');
4142
- function resolveData(paramsInheritanceStrategy, moduleInjector) {
4202
+ function resolveData(paramsInheritanceStrategy, injector) {
4143
4203
  return mergeMap(t => {
4144
4204
  const { targetSnapshot, guards: { canActivateChecks } } = t;
4145
4205
  if (!canActivateChecks.length) {
@@ -4147,43 +4207,45 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
4147
4207
  }
4148
4208
  let canActivateChecksResolved = 0;
4149
4209
  return from(canActivateChecks)
4150
- .pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, moduleInjector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
4210
+ .pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, injector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
4151
4211
  });
4152
4212
  }
4153
- function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) {
4213
+ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
4154
4214
  const config = futureARS.routeConfig;
4155
4215
  const resolve = futureARS._resolve;
4156
4216
  if (config?.title !== undefined && !hasStaticTitle(config)) {
4157
- resolve[RouteTitle] = config.title;
4217
+ resolve[RouteTitleKey] = config.title;
4158
4218
  }
4159
- return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
4160
- .pipe(map((resolvedData) => {
4219
+ return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => {
4161
4220
  futureARS._resolvedData = resolvedData;
4162
4221
  futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve;
4163
4222
  if (config && hasStaticTitle(config)) {
4164
- futureARS.data[RouteTitle] = config.title;
4223
+ futureARS.data[RouteTitleKey] = config.title;
4165
4224
  }
4166
4225
  return null;
4167
4226
  }));
4168
4227
  }
4169
- function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
4228
+ function resolveNode(resolve, futureARS, futureRSS, injector) {
4170
4229
  const keys = getDataKeys(resolve);
4171
4230
  if (keys.length === 0) {
4172
4231
  return of({});
4173
4232
  }
4174
4233
  const data = {};
4175
- return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, moduleInjector)
4234
+ return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector)
4176
4235
  .pipe(first(), tap((value) => {
4177
4236
  data[key] = value;
4178
- }))), takeLast(1), mapTo(data), catchError((e) => e instanceof EmptyError ? EMPTY : throwError(e)));
4237
+ }))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
4179
4238
  }
4180
4239
  function getDataKeys(obj) {
4181
4240
  return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
4182
4241
  }
4183
- function getResolver(injectionToken, futureARS, futureRSS, moduleInjector) {
4184
- const resolver = getToken(injectionToken, futureARS, moduleInjector);
4185
- return resolver.resolve ? wrapIntoObservable(resolver.resolve(futureARS, futureRSS)) :
4186
- wrapIntoObservable(resolver(futureARS, futureRSS));
4242
+ function getResolver(injectionToken, futureARS, futureRSS, injector) {
4243
+ const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
4244
+ const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
4245
+ const resolverValue = resolver.resolve ?
4246
+ resolver.resolve(futureARS, futureRSS) :
4247
+ closestInjector.runInContext(() => resolver(futureARS, futureRSS));
4248
+ return wrapIntoObservable(resolverValue);
4187
4249
  }
4188
4250
  function hasStaticTitle(config) {
4189
4251
  return typeof config.title === 'string' || config.title === null;
@@ -4212,6 +4274,90 @@ function switchTap(next) {
4212
4274
  });
4213
4275
  }
4214
4276
 
4277
+ /**
4278
+ * @license
4279
+ * Copyright Google LLC All Rights Reserved.
4280
+ *
4281
+ * Use of this source code is governed by an MIT-style license that can be
4282
+ * found in the LICENSE file at https://angular.io/license
4283
+ */
4284
+ /**
4285
+ * Provides a strategy for setting the page title after a router navigation.
4286
+ *
4287
+ * The built-in implementation traverses the router state snapshot and finds the deepest primary
4288
+ * outlet with `title` property. Given the `Routes` below, navigating to
4289
+ * `/base/child(popup:aux)` would result in the document title being set to "child".
4290
+ * ```
4291
+ * [
4292
+ * {path: 'base', title: 'base', children: [
4293
+ * {path: 'child', title: 'child'},
4294
+ * ],
4295
+ * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
4296
+ * ]
4297
+ * ```
4298
+ *
4299
+ * This class can be used as a base class for custom title strategies. That is, you can create your
4300
+ * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
4301
+ * from the named outlet is never used. However, a custom strategy might be implemented to
4302
+ * incorporate titles in named outlets.
4303
+ *
4304
+ * @publicApi
4305
+ * @see [Page title guide](guide/router#setting-the-page-title)
4306
+ */
4307
+ class TitleStrategy {
4308
+ /**
4309
+ * @returns The `title` of the deepest primary route.
4310
+ */
4311
+ buildTitle(snapshot) {
4312
+ let pageTitle;
4313
+ let route = snapshot.root;
4314
+ while (route !== undefined) {
4315
+ pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
4316
+ route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
4317
+ }
4318
+ return pageTitle;
4319
+ }
4320
+ /**
4321
+ * Given an `ActivatedRouteSnapshot`, returns the final value of the
4322
+ * `Route.title` property, which can either be a static string or a resolved value.
4323
+ */
4324
+ getResolvedTitleForRoute(snapshot) {
4325
+ return snapshot.data[RouteTitleKey];
4326
+ }
4327
+ }
4328
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4329
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: TitleStrategy, decorators: [{
4331
+ type: Injectable,
4332
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4333
+ }] });
4334
+ /**
4335
+ * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
4336
+ */
4337
+ class DefaultTitleStrategy extends TitleStrategy {
4338
+ constructor(title) {
4339
+ super();
4340
+ this.title = title;
4341
+ }
4342
+ /**
4343
+ * Sets the title of the browser to the given value.
4344
+ *
4345
+ * @param title The `pageTitle` from the deepest primary route.
4346
+ */
4347
+ updateTitle(snapshot) {
4348
+ const title = this.buildTitle(snapshot);
4349
+ if (title !== undefined) {
4350
+ this.title.setTitle(title);
4351
+ }
4352
+ }
4353
+ }
4354
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4355
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4357
+ type: Injectable,
4358
+ args: [{ providedIn: 'root' }]
4359
+ }], ctorParameters: function () { return [{ type: i1.Title }]; } });
4360
+
4215
4361
  /**
4216
4362
  * @license
4217
4363
  * Copyright Google LLC All Rights Reserved.
@@ -4277,6 +4423,24 @@ class BaseRouteReuseStrategy {
4277
4423
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4278
4424
  }
4279
4425
 
4426
+ /**
4427
+ * @license
4428
+ * Copyright Google LLC All Rights Reserved.
4429
+ *
4430
+ * Use of this source code is governed by an MIT-style license that can be
4431
+ * found in the LICENSE file at https://angular.io/license
4432
+ */
4433
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4434
+ /**
4435
+ * A [DI token](guide/glossary/#di-token) for the router service.
4436
+ *
4437
+ * @publicApi
4438
+ */
4439
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4440
+ providedIn: 'root',
4441
+ factory: () => ({}),
4442
+ });
4443
+
4280
4444
  /**
4281
4445
  * @license
4282
4446
  * Copyright Google LLC All Rights Reserved.
@@ -4383,10 +4547,11 @@ class RouterConfigLoader {
4383
4547
  }));
4384
4548
  }
4385
4549
  }
4386
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4387
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader });
4388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4389
- type: Injectable
4550
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4551
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4553
+ type: Injectable,
4554
+ args: [{ providedIn: 'root' }]
4390
4555
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4391
4556
 
4392
4557
  /**
@@ -4454,6 +4619,52 @@ const subsetMatchOptions = {
4454
4619
  matrixParams: 'ignored',
4455
4620
  queryParams: 'subset'
4456
4621
  };
4622
+ function assignExtraOptionsToRouter(opts, router) {
4623
+ if (opts.errorHandler) {
4624
+ router.errorHandler = opts.errorHandler;
4625
+ }
4626
+ if (opts.malformedUriErrorHandler) {
4627
+ router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
4628
+ }
4629
+ if (opts.onSameUrlNavigation) {
4630
+ router.onSameUrlNavigation = opts.onSameUrlNavigation;
4631
+ }
4632
+ if (opts.paramsInheritanceStrategy) {
4633
+ router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
4634
+ }
4635
+ if (opts.relativeLinkResolution) {
4636
+ router.relativeLinkResolution = opts.relativeLinkResolution;
4637
+ }
4638
+ if (opts.urlUpdateStrategy) {
4639
+ router.urlUpdateStrategy = opts.urlUpdateStrategy;
4640
+ }
4641
+ if (opts.canceledNavigationResolution) {
4642
+ router.canceledNavigationResolution = opts.canceledNavigationResolution;
4643
+ }
4644
+ }
4645
+ function setupRouter() {
4646
+ const urlSerializer = inject(UrlSerializer);
4647
+ const contexts = inject(ChildrenOutletContexts);
4648
+ const location = inject(Location);
4649
+ const injector = inject(Injector);
4650
+ const compiler = inject(Compiler);
4651
+ const config = inject(ROUTES, { optional: true }) ?? [];
4652
+ const opts = inject(ROUTER_CONFIGURATION, { optional: true }) ?? {};
4653
+ const defaultTitleStrategy = inject(DefaultTitleStrategy);
4654
+ const titleStrategy = inject(TitleStrategy, { optional: true });
4655
+ const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
4656
+ const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
4657
+ const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
4658
+ if (urlHandlingStrategy) {
4659
+ router.urlHandlingStrategy = urlHandlingStrategy;
4660
+ }
4661
+ if (routeReuseStrategy) {
4662
+ router.routeReuseStrategy = routeReuseStrategy;
4663
+ }
4664
+ router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
4665
+ assignExtraOptionsToRouter(opts, router);
4666
+ return router;
4667
+ }
4457
4668
  /**
4458
4669
  * @description
4459
4670
  *
@@ -5365,10 +5576,14 @@ class Router {
5365
5576
  return { navigationId };
5366
5577
  }
5367
5578
  }
5368
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5369
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router });
5370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router, decorators: [{
5371
- type: Injectable
5579
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5580
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: Router, decorators: [{
5582
+ type: Injectable,
5583
+ args: [{
5584
+ providedIn: 'root',
5585
+ useFactory: setupRouter,
5586
+ }]
5372
5587
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5373
5588
  function validateCommands(commands) {
5374
5589
  for (let i = 0; i < commands.length; i++) {
@@ -5566,11 +5781,14 @@ class RouterLink {
5566
5781
  });
5567
5782
  }
5568
5783
  }
5569
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5570
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5571
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLink, decorators: [{
5784
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5785
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.1", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5786
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterLink, decorators: [{
5572
5787
  type: Directive,
5573
- args: [{ selector: ':not(a):not(area)[routerLink]' }]
5788
+ args: [{
5789
+ selector: ':not(a):not(area)[routerLink]',
5790
+ standalone: true,
5791
+ }]
5574
5792
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
5575
5793
  type: Attribute,
5576
5794
  args: ['tabindex']
@@ -5685,11 +5903,11 @@ class RouterLinkWithHref {
5685
5903
  });
5686
5904
  }
5687
5905
  }
5688
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5689
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5906
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5907
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.1", type: RouterLinkWithHref, isStandalone: true, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5908
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5691
5909
  type: Directive,
5692
- args: [{ selector: 'a[routerLink],area[routerLink]' }]
5910
+ args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
5693
5911
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
5694
5912
  type: HostBinding,
5695
5913
  args: ['attr.target']
@@ -5912,13 +6130,14 @@ class RouterLinkActive {
5912
6130
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5913
6131
  }
5914
6132
  }
5915
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5916
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5917
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6133
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6134
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.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 }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6135
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterLinkActive, decorators: [{
5918
6136
  type: Directive,
5919
6137
  args: [{
5920
6138
  selector: '[routerLinkActive]',
5921
6139
  exportAs: 'routerLinkActive',
6140
+ standalone: true,
5922
6141
  }]
5923
6142
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
5924
6143
  type: Optional
@@ -5946,90 +6165,6 @@ function isActiveMatchOptions(options) {
5946
6165
  return !!options.paths;
5947
6166
  }
5948
6167
 
5949
- /**
5950
- * @license
5951
- * Copyright Google LLC All Rights Reserved.
5952
- *
5953
- * Use of this source code is governed by an MIT-style license that can be
5954
- * found in the LICENSE file at https://angular.io/license
5955
- */
5956
- /**
5957
- * Provides a strategy for setting the page title after a router navigation.
5958
- *
5959
- * The built-in implementation traverses the router state snapshot and finds the deepest primary
5960
- * outlet with `title` property. Given the `Routes` below, navigating to
5961
- * `/base/child(popup:aux)` would result in the document title being set to "child".
5962
- * ```
5963
- * [
5964
- * {path: 'base', title: 'base', children: [
5965
- * {path: 'child', title: 'child'},
5966
- * ],
5967
- * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
5968
- * ]
5969
- * ```
5970
- *
5971
- * This class can be used as a base class for custom title strategies. That is, you can create your
5972
- * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
5973
- * from the named outlet is never used. However, a custom strategy might be implemented to
5974
- * incorporate titles in named outlets.
5975
- *
5976
- * @publicApi
5977
- * @see [Page title guide](guide/router#setting-the-page-title)
5978
- */
5979
- class TitleStrategy {
5980
- /**
5981
- * @returns The `title` of the deepest primary route.
5982
- */
5983
- buildTitle(snapshot) {
5984
- let pageTitle;
5985
- let route = snapshot.root;
5986
- while (route !== undefined) {
5987
- pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
5988
- route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
5989
- }
5990
- return pageTitle;
5991
- }
5992
- /**
5993
- * Given an `ActivatedRouteSnapshot`, returns the final value of the
5994
- * `Route.title` property, which can either be a static string or a resolved value.
5995
- */
5996
- getResolvedTitleForRoute(snapshot) {
5997
- return snapshot.data[RouteTitle];
5998
- }
5999
- }
6000
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6001
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
6002
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, decorators: [{
6003
- type: Injectable,
6004
- args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
6005
- }] });
6006
- /**
6007
- * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
6008
- */
6009
- class DefaultTitleStrategy extends TitleStrategy {
6010
- constructor(title) {
6011
- super();
6012
- this.title = title;
6013
- }
6014
- /**
6015
- * Sets the title of the browser to the given value.
6016
- *
6017
- * @param title The `pageTitle` from the deepest primary route.
6018
- */
6019
- updateTitle(snapshot) {
6020
- const title = this.buildTitle(snapshot);
6021
- if (title !== undefined) {
6022
- this.title.setTitle(title);
6023
- }
6024
- }
6025
- }
6026
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
6027
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6028
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6029
- type: Injectable,
6030
- args: [{ providedIn: 'root' }]
6031
- }], ctorParameters: function () { return [{ type: i1.Title }]; } });
6032
-
6033
6168
  /**
6034
6169
  * @license
6035
6170
  * Copyright Google LLC All Rights Reserved.
@@ -6062,9 +6197,9 @@ class PreloadAllModules {
6062
6197
  return fn().pipe(catchError(() => of(null)));
6063
6198
  }
6064
6199
  }
6065
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6066
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6067
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6200
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6201
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6068
6203
  type: Injectable,
6069
6204
  args: [{ providedIn: 'root' }]
6070
6205
  }] });
@@ -6082,9 +6217,9 @@ class NoPreloading {
6082
6217
  return of(null);
6083
6218
  }
6084
6219
  }
6085
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6086
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6087
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, decorators: [{
6220
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6221
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: NoPreloading, decorators: [{
6088
6223
  type: Injectable,
6089
6224
  args: [{ providedIn: 'root' }]
6090
6225
  }] });
@@ -6131,7 +6266,15 @@ class RouterPreloader {
6131
6266
  }
6132
6267
  const injectorForCurrentRoute = route._injector ?? injector;
6133
6268
  const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;
6134
- if ((route.loadChildren && !route._loadedRoutes) ||
6269
+ // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not
6270
+ // `loadComponent`. `canLoad` guards only block loading of child routes by design. This
6271
+ // happens as a consequence of needing to descend into children for route matching immediately
6272
+ // while component loading is deferred until route activation. Because `canLoad` guards can
6273
+ // have side effects, we cannot execute them here so we instead skip preloading altogether
6274
+ // when present. Lastly, it remains to be decided whether `canLoad` should behave this way
6275
+ // at all. Code splitting and lazy loading is separate from client-side authorization checks
6276
+ // and should not be used as a security measure to prevent loading of code.
6277
+ if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||
6135
6278
  (route.loadComponent && !route._loadedComponent)) {
6136
6279
  res.push(this.preloadConfig(injectorForCurrentRoute, route));
6137
6280
  }
@@ -6170,9 +6313,9 @@ class RouterPreloader {
6170
6313
  });
6171
6314
  }
6172
6315
  }
6173
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6174
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader });
6175
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader, decorators: [{
6316
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6317
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterPreloader });
6318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterPreloader, decorators: [{
6176
6319
  type: Injectable
6177
6320
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6178
6321
 
@@ -6259,9 +6402,9 @@ class RouterScroller {
6259
6402
  }
6260
6403
  }
6261
6404
  }
6262
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6263
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller });
6264
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller, decorators: [{
6405
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6406
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterScroller });
6407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterScroller, decorators: [{
6265
6408
  type: Injectable
6266
6409
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6267
6410
 
@@ -6277,36 +6420,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6277
6420
  * The directives defined in the `RouterModule`.
6278
6421
  */
6279
6422
  const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent];
6280
- /**
6281
- * A [DI token](guide/glossary/#di-token) for the router service.
6282
- *
6283
- * @publicApi
6284
- */
6285
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6286
- providedIn: 'root',
6287
- factory: () => ({}),
6288
- });
6289
6423
  /**
6290
6424
  * @docsNotRequired
6291
6425
  */
6292
6426
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6293
6427
  const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6428
+ // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6429
+ // here to avoid a breaking change whereby the provider order matters based on where the
6430
+ // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
6431
+ // change in a major version.
6294
6432
  const ROUTER_PROVIDERS = [
6295
6433
  Location,
6296
6434
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
6297
- {
6298
- provide: Router,
6299
- useFactory: setupRouter,
6300
- deps: [
6301
- UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES, TitleStrategy,
6302
- ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()],
6303
- [RouteReuseStrategy, new Optional()]
6304
- ]
6305
- },
6435
+ { provide: Router, useFactory: setupRouter },
6306
6436
  ChildrenOutletContexts,
6307
6437
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6308
6438
  RouterConfigLoader,
6309
6439
  ];
6440
+ function rootRoute(router) {
6441
+ return router.routerState.root;
6442
+ }
6310
6443
  function routerNgProbeToken() {
6311
6444
  return new NgProbeToken('Router', Router);
6312
6445
  }
@@ -6332,8 +6465,7 @@ function routerNgProbeToken() {
6332
6465
  * @publicApi
6333
6466
  */
6334
6467
  class RouterModule {
6335
- // Note: We are injecting the Router so it gets created eagerly...
6336
- constructor(guard, router) { }
6468
+ constructor(guard) { }
6337
6469
  /**
6338
6470
  * Creates and configures a module with all the router providers and directives.
6339
6471
  * Optionally sets up an application listener to perform an initial navigation.
@@ -6394,13 +6526,13 @@ class RouterModule {
6394
6526
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6395
6527
  }
6396
6528
  }
6397
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6398
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6399
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule });
6400
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, decorators: [{
6529
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6530
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6531
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6532
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: RouterModule, decorators: [{
6401
6533
  type: NgModule,
6402
6534
  args: [{
6403
- declarations: ROUTER_DIRECTIVES,
6535
+ imports: ROUTER_DIRECTIVES,
6404
6536
  exports: ROUTER_DIRECTIVES,
6405
6537
  }]
6406
6538
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
@@ -6408,8 +6540,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
6408
6540
  }, {
6409
6541
  type: Inject,
6410
6542
  args: [ROUTER_FORROOT_GUARD]
6411
- }] }, { type: Router, decorators: [{
6412
- type: Optional
6413
6543
  }] }]; } });
6414
6544
  function provideRouterScroller() {
6415
6545
  return {
@@ -6455,48 +6585,9 @@ function provideForRootGuard(router) {
6455
6585
  */
6456
6586
  function provideRoutes(routes) {
6457
6587
  return [
6458
- { provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
6459
6588
  { provide: ROUTES, multi: true, useValue: routes },
6460
6589
  ];
6461
6590
  }
6462
- function setupRouter(urlSerializer, contexts, location, injector, compiler, config, titleStrategy, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
6463
- const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
6464
- if (urlHandlingStrategy) {
6465
- router.urlHandlingStrategy = urlHandlingStrategy;
6466
- }
6467
- if (routeReuseStrategy) {
6468
- router.routeReuseStrategy = routeReuseStrategy;
6469
- }
6470
- router.titleStrategy = titleStrategy;
6471
- assignExtraOptionsToRouter(opts, router);
6472
- return router;
6473
- }
6474
- function assignExtraOptionsToRouter(opts, router) {
6475
- if (opts.errorHandler) {
6476
- router.errorHandler = opts.errorHandler;
6477
- }
6478
- if (opts.malformedUriErrorHandler) {
6479
- router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
6480
- }
6481
- if (opts.onSameUrlNavigation) {
6482
- router.onSameUrlNavigation = opts.onSameUrlNavigation;
6483
- }
6484
- if (opts.paramsInheritanceStrategy) {
6485
- router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
6486
- }
6487
- if (opts.relativeLinkResolution) {
6488
- router.relativeLinkResolution = opts.relativeLinkResolution;
6489
- }
6490
- if (opts.urlUpdateStrategy) {
6491
- router.urlUpdateStrategy = opts.urlUpdateStrategy;
6492
- }
6493
- if (opts.canceledNavigationResolution) {
6494
- router.canceledNavigationResolution = opts.canceledNavigationResolution;
6495
- }
6496
- }
6497
- function rootRoute(router) {
6498
- return router.routerState.root;
6499
- }
6500
6591
  function getBootstrapListener() {
6501
6592
  const injector = inject(Injector);
6502
6593
  return (bootstrappedComponentRef) => {
@@ -6506,8 +6597,7 @@ function getBootstrapListener() {
6506
6597
  }
6507
6598
  const router = injector.get(Router);
6508
6599
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6509
- // Default case
6510
- if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6600
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6511
6601
  router.initialNavigation();
6512
6602
  }
6513
6603
  injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
@@ -6551,7 +6641,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
6551
6641
  });
6552
6642
  function provideEnabledBlockingInitialNavigation() {
6553
6643
  return [
6554
- { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6644
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6555
6645
  {
6556
6646
  provide: APP_INITIALIZER,
6557
6647
  multi: true,
@@ -6617,7 +6707,7 @@ function provideEnabledBlockingInitialNavigation() {
6617
6707
  },
6618
6708
  ];
6619
6709
  }
6620
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6710
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6621
6711
  function provideDisabledInitialNavigation() {
6622
6712
  return [
6623
6713
  {
@@ -6630,7 +6720,7 @@ function provideDisabledInitialNavigation() {
6630
6720
  };
6631
6721
  }
6632
6722
  },
6633
- { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6723
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6634
6724
  ];
6635
6725
  }
6636
6726
  function provideTracing() {
@@ -6673,7 +6763,7 @@ function providePreloading(preloadingStrategy) {
6673
6763
  /**
6674
6764
  * @publicApi
6675
6765
  */
6676
- const VERSION = new Version('14.1.0');
6766
+ const VERSION = new Version('14.2.0-next.1');
6677
6767
 
6678
6768
  /**
6679
6769
  * @license
@@ -6712,5 +6802,5 @@ const VERSION = new Version('14.1.0');
6712
6802
  * Generated bundle index. Do not edit.
6713
6803
  */
6714
6804
 
6715
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6805
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6716
6806
  //# sourceMappingURL=router.mjs.map