@angular/router 14.1.0 → 14.1.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.
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/directives/router_link.mjs +6 -6
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/index.mjs +3 -2
- package/esm2020/src/page_title_strategy.mjs +6 -6
- package/esm2020/src/private_export.mjs +3 -2
- package/esm2020/src/router.mjs +62 -9
- package/esm2020/src/router_config.mjs +19 -0
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +21 -78
- package/esm2020/src/router_preloader.mjs +19 -11
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +4 -4
- package/fesm2015/router.mjs +248 -217
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +238 -215
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +4 -7
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2020/router.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.
|
|
2
|
+
* @license Angular v14.1.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,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, inject, Injectable, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, NgProbeToken, SkipSelf, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
|
|
9
9
|
import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import * as i3 from '@angular/common';
|
|
11
11
|
import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
|
|
@@ -182,7 +182,7 @@ function wrapIntoObservable(value) {
|
|
|
182
182
|
* Use of this source code is governed by an MIT-style license that can be
|
|
183
183
|
* found in the LICENSE file at https://angular.io/license
|
|
184
184
|
*/
|
|
185
|
-
const NG_DEV_MODE$
|
|
185
|
+
const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
186
186
|
function createEmptyUrlTree() {
|
|
187
187
|
return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
|
|
188
188
|
}
|
|
@@ -647,7 +647,7 @@ class UrlParser {
|
|
|
647
647
|
parseSegment() {
|
|
648
648
|
const path = matchSegments(this.remaining);
|
|
649
649
|
if (path === '' && this.peekStartsWith(';')) {
|
|
650
|
-
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$
|
|
650
|
+
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
|
|
651
651
|
}
|
|
652
652
|
this.capture(path);
|
|
653
653
|
return new UrlSegment(decode(path), this.parseMatrixParams());
|
|
@@ -716,7 +716,7 @@ class UrlParser {
|
|
|
716
716
|
// if is is not one of these characters, then the segment was unescaped
|
|
717
717
|
// or the group was not closed
|
|
718
718
|
if (next !== '/' && next !== ')' && next !== ';') {
|
|
719
|
-
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$
|
|
719
|
+
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
|
|
720
720
|
}
|
|
721
721
|
let outletName = undefined;
|
|
722
722
|
if (path.indexOf(':') > -1) {
|
|
@@ -747,7 +747,7 @@ class UrlParser {
|
|
|
747
747
|
}
|
|
748
748
|
capture(str) {
|
|
749
749
|
if (!this.consumeOptional(str)) {
|
|
750
|
-
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$
|
|
750
|
+
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
}
|
|
@@ -800,7 +800,7 @@ function isUrlTree(v) {
|
|
|
800
800
|
* Use of this source code is governed by an MIT-style license that can be
|
|
801
801
|
* found in the LICENSE file at https://angular.io/license
|
|
802
802
|
*/
|
|
803
|
-
const NG_DEV_MODE$
|
|
803
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
804
804
|
/**
|
|
805
805
|
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
806
806
|
*
|
|
@@ -976,11 +976,11 @@ class Navigation {
|
|
|
976
976
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
977
977
|
this.commands = commands;
|
|
978
978
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
979
|
-
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$
|
|
979
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
|
|
980
980
|
}
|
|
981
981
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
982
982
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
983
|
-
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$
|
|
983
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
986
|
toRoot() {
|
|
@@ -1079,7 +1079,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1079
1079
|
dd -= ci;
|
|
1080
1080
|
g = g.parent;
|
|
1081
1081
|
if (!g) {
|
|
1082
|
-
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$
|
|
1082
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
|
|
1083
1083
|
}
|
|
1084
1084
|
ci = g.segments.length;
|
|
1085
1085
|
}
|
|
@@ -2360,7 +2360,7 @@ class ChildrenOutletContexts {
|
|
|
2360
2360
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2361
2361
|
* found in the LICENSE file at https://angular.io/license
|
|
2362
2362
|
*/
|
|
2363
|
-
const NG_DEV_MODE$
|
|
2363
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2364
2364
|
/**
|
|
2365
2365
|
* @description
|
|
2366
2366
|
*
|
|
@@ -2469,12 +2469,12 @@ class RouterOutlet {
|
|
|
2469
2469
|
*/
|
|
2470
2470
|
get component() {
|
|
2471
2471
|
if (!this.activated)
|
|
2472
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2472
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
|
|
2473
2473
|
return this.activated.instance;
|
|
2474
2474
|
}
|
|
2475
2475
|
get activatedRoute() {
|
|
2476
2476
|
if (!this.activated)
|
|
2477
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2477
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
|
|
2478
2478
|
return this._activatedRoute;
|
|
2479
2479
|
}
|
|
2480
2480
|
get activatedRouteData() {
|
|
@@ -2488,7 +2488,7 @@ class RouterOutlet {
|
|
|
2488
2488
|
*/
|
|
2489
2489
|
detach() {
|
|
2490
2490
|
if (!this.activated)
|
|
2491
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2491
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
|
|
2492
2492
|
this.location.detach();
|
|
2493
2493
|
const cmp = this.activated;
|
|
2494
2494
|
this.activated = null;
|
|
@@ -2516,7 +2516,7 @@ class RouterOutlet {
|
|
|
2516
2516
|
}
|
|
2517
2517
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2518
2518
|
if (this.isActivated) {
|
|
2519
|
-
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$
|
|
2519
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
|
|
2520
2520
|
}
|
|
2521
2521
|
this._activatedRoute = activatedRoute;
|
|
2522
2522
|
const location = this.location;
|
|
@@ -2538,9 +2538,9 @@ class RouterOutlet {
|
|
|
2538
2538
|
this.activateEvents.emit(this.activated.instance);
|
|
2539
2539
|
}
|
|
2540
2540
|
}
|
|
2541
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
2542
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.
|
|
2543
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
2541
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
|
|
2542
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", 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.1", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2544
2544
|
type: Directive,
|
|
2545
2545
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2546
2546
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
@@ -2597,9 +2597,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2597
2597
|
*/
|
|
2598
2598
|
class ɵEmptyOutletComponent {
|
|
2599
2599
|
}
|
|
2600
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
2601
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.
|
|
2602
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
2600
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2601
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", 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.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2603
2603
|
type: Component,
|
|
2604
2604
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2605
2605
|
}] });
|
|
@@ -3493,7 +3493,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3493
3493
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3494
3494
|
* found in the LICENSE file at https://angular.io/license
|
|
3495
3495
|
*/
|
|
3496
|
-
const NG_DEV_MODE$
|
|
3496
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3497
3497
|
class NoMatch$1 {
|
|
3498
3498
|
constructor(segmentGroup) {
|
|
3499
3499
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3511,11 +3511,11 @@ function absoluteRedirect(newTree) {
|
|
|
3511
3511
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3512
3512
|
}
|
|
3513
3513
|
function namedOutletsRedirect(redirectTo) {
|
|
3514
|
-
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$
|
|
3514
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
|
|
3515
3515
|
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3516
3516
|
}
|
|
3517
3517
|
function canLoadFails(route) {
|
|
3518
|
-
return throwError(navigationCancelingError(NG_DEV_MODE$
|
|
3518
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
|
|
3519
3519
|
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3520
3520
|
}
|
|
3521
3521
|
/**
|
|
@@ -3575,7 +3575,7 @@ class ApplyRedirects {
|
|
|
3575
3575
|
}));
|
|
3576
3576
|
}
|
|
3577
3577
|
noMatchError(e) {
|
|
3578
|
-
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$
|
|
3578
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3579
3579
|
}
|
|
3580
3580
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3581
3581
|
const root = createRoot(rootCandidate);
|
|
@@ -3790,7 +3790,7 @@ class ApplyRedirects {
|
|
|
3790
3790
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3791
3791
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3792
3792
|
if (!pos)
|
|
3793
|
-
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$
|
|
3793
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
|
|
3794
3794
|
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3795
3795
|
return pos;
|
|
3796
3796
|
}
|
|
@@ -3826,7 +3826,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
|
|
|
3826
3826
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3827
3827
|
* found in the LICENSE file at https://angular.io/license
|
|
3828
3828
|
*/
|
|
3829
|
-
const NG_DEV_MODE$
|
|
3829
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3830
3830
|
class NoMatch {
|
|
3831
3831
|
}
|
|
3832
3832
|
function newObservableError(e) {
|
|
@@ -3915,7 +3915,7 @@ class Recognizer {
|
|
|
3915
3915
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3916
3916
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3917
3917
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3918
|
-
if (NG_DEV_MODE$
|
|
3918
|
+
if (NG_DEV_MODE$4) {
|
|
3919
3919
|
// This should really never happen - we are only taking the first match for each
|
|
3920
3920
|
// outlet and merge the empty path matches.
|
|
3921
3921
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -3948,7 +3948,7 @@ class Recognizer {
|
|
|
3948
3948
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3949
3949
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3950
3950
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3951
|
-
(NG_DEV_MODE$
|
|
3951
|
+
(NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3952
3952
|
pathIndexShift));
|
|
3953
3953
|
matchResult = of({
|
|
3954
3954
|
snapshot,
|
|
@@ -3964,7 +3964,7 @@ class Recognizer {
|
|
|
3964
3964
|
return null;
|
|
3965
3965
|
}
|
|
3966
3966
|
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$
|
|
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$4 ?
|
|
3968
3968
|
getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3969
3969
|
pathIndexShift));
|
|
3970
3970
|
return { snapshot, consumedSegments, remainingSegments };
|
|
@@ -4077,7 +4077,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4077
4077
|
if (routeWithSameOutletName) {
|
|
4078
4078
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4079
4079
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4080
|
-
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$
|
|
4080
|
+
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
4081
|
}
|
|
4082
4082
|
names[n.value.outlet] = n.value;
|
|
4083
4083
|
});
|
|
@@ -4212,6 +4212,90 @@ function switchTap(next) {
|
|
|
4212
4212
|
});
|
|
4213
4213
|
}
|
|
4214
4214
|
|
|
4215
|
+
/**
|
|
4216
|
+
* @license
|
|
4217
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4218
|
+
*
|
|
4219
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4220
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4221
|
+
*/
|
|
4222
|
+
/**
|
|
4223
|
+
* Provides a strategy for setting the page title after a router navigation.
|
|
4224
|
+
*
|
|
4225
|
+
* The built-in implementation traverses the router state snapshot and finds the deepest primary
|
|
4226
|
+
* outlet with `title` property. Given the `Routes` below, navigating to
|
|
4227
|
+
* `/base/child(popup:aux)` would result in the document title being set to "child".
|
|
4228
|
+
* ```
|
|
4229
|
+
* [
|
|
4230
|
+
* {path: 'base', title: 'base', children: [
|
|
4231
|
+
* {path: 'child', title: 'child'},
|
|
4232
|
+
* ],
|
|
4233
|
+
* {path: 'aux', outlet: 'popup', title: 'popupTitle'}
|
|
4234
|
+
* ]
|
|
4235
|
+
* ```
|
|
4236
|
+
*
|
|
4237
|
+
* This class can be used as a base class for custom title strategies. That is, you can create your
|
|
4238
|
+
* own class that extends the `TitleStrategy`. Note that in the above example, the `title`
|
|
4239
|
+
* from the named outlet is never used. However, a custom strategy might be implemented to
|
|
4240
|
+
* incorporate titles in named outlets.
|
|
4241
|
+
*
|
|
4242
|
+
* @publicApi
|
|
4243
|
+
* @see [Page title guide](guide/router#setting-the-page-title)
|
|
4244
|
+
*/
|
|
4245
|
+
class TitleStrategy {
|
|
4246
|
+
/**
|
|
4247
|
+
* @returns The `title` of the deepest primary route.
|
|
4248
|
+
*/
|
|
4249
|
+
buildTitle(snapshot) {
|
|
4250
|
+
let pageTitle;
|
|
4251
|
+
let route = snapshot.root;
|
|
4252
|
+
while (route !== undefined) {
|
|
4253
|
+
pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
|
|
4254
|
+
route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
|
|
4255
|
+
}
|
|
4256
|
+
return pageTitle;
|
|
4257
|
+
}
|
|
4258
|
+
/**
|
|
4259
|
+
* Given an `ActivatedRouteSnapshot`, returns the final value of the
|
|
4260
|
+
* `Route.title` property, which can either be a static string or a resolved value.
|
|
4261
|
+
*/
|
|
4262
|
+
getResolvedTitleForRoute(snapshot) {
|
|
4263
|
+
return snapshot.data[RouteTitle];
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4267
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4268
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4269
|
+
type: Injectable,
|
|
4270
|
+
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4271
|
+
}] });
|
|
4272
|
+
/**
|
|
4273
|
+
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
4274
|
+
*/
|
|
4275
|
+
class DefaultTitleStrategy extends TitleStrategy {
|
|
4276
|
+
constructor(title) {
|
|
4277
|
+
super();
|
|
4278
|
+
this.title = title;
|
|
4279
|
+
}
|
|
4280
|
+
/**
|
|
4281
|
+
* Sets the title of the browser to the given value.
|
|
4282
|
+
*
|
|
4283
|
+
* @param title The `pageTitle` from the deepest primary route.
|
|
4284
|
+
*/
|
|
4285
|
+
updateTitle(snapshot) {
|
|
4286
|
+
const title = this.buildTitle(snapshot);
|
|
4287
|
+
if (title !== undefined) {
|
|
4288
|
+
this.title.setTitle(title);
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4293
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4295
|
+
type: Injectable,
|
|
4296
|
+
args: [{ providedIn: 'root' }]
|
|
4297
|
+
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
4298
|
+
|
|
4215
4299
|
/**
|
|
4216
4300
|
* @license
|
|
4217
4301
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4277,6 +4361,24 @@ class BaseRouteReuseStrategy {
|
|
|
4277
4361
|
class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
4278
4362
|
}
|
|
4279
4363
|
|
|
4364
|
+
/**
|
|
4365
|
+
* @license
|
|
4366
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4367
|
+
*
|
|
4368
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4369
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4370
|
+
*/
|
|
4371
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4372
|
+
/**
|
|
4373
|
+
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
4374
|
+
*
|
|
4375
|
+
* @publicApi
|
|
4376
|
+
*/
|
|
4377
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
|
|
4378
|
+
providedIn: 'root',
|
|
4379
|
+
factory: () => ({}),
|
|
4380
|
+
});
|
|
4381
|
+
|
|
4280
4382
|
/**
|
|
4281
4383
|
* @license
|
|
4282
4384
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4383,9 +4485,9 @@ class RouterConfigLoader {
|
|
|
4383
4485
|
}));
|
|
4384
4486
|
}
|
|
4385
4487
|
}
|
|
4386
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
4387
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
4388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
4488
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4489
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterConfigLoader });
|
|
4490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4389
4491
|
type: Injectable
|
|
4390
4492
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4391
4493
|
|
|
@@ -4454,6 +4556,52 @@ const subsetMatchOptions = {
|
|
|
4454
4556
|
matrixParams: 'ignored',
|
|
4455
4557
|
queryParams: 'subset'
|
|
4456
4558
|
};
|
|
4559
|
+
function assignExtraOptionsToRouter(opts, router) {
|
|
4560
|
+
if (opts.errorHandler) {
|
|
4561
|
+
router.errorHandler = opts.errorHandler;
|
|
4562
|
+
}
|
|
4563
|
+
if (opts.malformedUriErrorHandler) {
|
|
4564
|
+
router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
|
|
4565
|
+
}
|
|
4566
|
+
if (opts.onSameUrlNavigation) {
|
|
4567
|
+
router.onSameUrlNavigation = opts.onSameUrlNavigation;
|
|
4568
|
+
}
|
|
4569
|
+
if (opts.paramsInheritanceStrategy) {
|
|
4570
|
+
router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
|
4571
|
+
}
|
|
4572
|
+
if (opts.relativeLinkResolution) {
|
|
4573
|
+
router.relativeLinkResolution = opts.relativeLinkResolution;
|
|
4574
|
+
}
|
|
4575
|
+
if (opts.urlUpdateStrategy) {
|
|
4576
|
+
router.urlUpdateStrategy = opts.urlUpdateStrategy;
|
|
4577
|
+
}
|
|
4578
|
+
if (opts.canceledNavigationResolution) {
|
|
4579
|
+
router.canceledNavigationResolution = opts.canceledNavigationResolution;
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
function setupRouter() {
|
|
4583
|
+
const urlSerializer = inject(UrlSerializer);
|
|
4584
|
+
const contexts = inject(ChildrenOutletContexts);
|
|
4585
|
+
const location = inject(Location);
|
|
4586
|
+
const injector = inject(Injector);
|
|
4587
|
+
const compiler = inject(Compiler);
|
|
4588
|
+
const config = inject(ROUTES, { optional: true }) ?? [];
|
|
4589
|
+
const opts = inject(ROUTER_CONFIGURATION, { optional: true }) ?? {};
|
|
4590
|
+
const defaultTitleStrategy = inject(DefaultTitleStrategy);
|
|
4591
|
+
const titleStrategy = inject(TitleStrategy, { optional: true });
|
|
4592
|
+
const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
|
|
4593
|
+
const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
|
|
4594
|
+
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
4595
|
+
if (urlHandlingStrategy) {
|
|
4596
|
+
router.urlHandlingStrategy = urlHandlingStrategy;
|
|
4597
|
+
}
|
|
4598
|
+
if (routeReuseStrategy) {
|
|
4599
|
+
router.routeReuseStrategy = routeReuseStrategy;
|
|
4600
|
+
}
|
|
4601
|
+
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
4602
|
+
assignExtraOptionsToRouter(opts, router);
|
|
4603
|
+
return router;
|
|
4604
|
+
}
|
|
4457
4605
|
/**
|
|
4458
4606
|
* @description
|
|
4459
4607
|
*
|
|
@@ -5365,10 +5513,14 @@ class Router {
|
|
|
5365
5513
|
return { navigationId };
|
|
5366
5514
|
}
|
|
5367
5515
|
}
|
|
5368
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5369
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
5370
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
5371
|
-
type: Injectable
|
|
5516
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5517
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
|
|
5518
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: Router, decorators: [{
|
|
5519
|
+
type: Injectable,
|
|
5520
|
+
args: [{
|
|
5521
|
+
providedIn: 'root',
|
|
5522
|
+
useFactory: setupRouter,
|
|
5523
|
+
}]
|
|
5372
5524
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5373
5525
|
function validateCommands(commands) {
|
|
5374
5526
|
for (let i = 0; i < commands.length; i++) {
|
|
@@ -5566,9 +5718,9 @@ class RouterLink {
|
|
|
5566
5718
|
});
|
|
5567
5719
|
}
|
|
5568
5720
|
}
|
|
5569
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5570
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.
|
|
5571
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
5721
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5722
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", 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 });
|
|
5723
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLink, decorators: [{
|
|
5572
5724
|
type: Directive,
|
|
5573
5725
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5574
5726
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
@@ -5685,9 +5837,9 @@ class RouterLinkWithHref {
|
|
|
5685
5837
|
});
|
|
5686
5838
|
}
|
|
5687
5839
|
}
|
|
5688
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5689
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.
|
|
5690
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
5840
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5841
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", 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 });
|
|
5842
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5691
5843
|
type: Directive,
|
|
5692
5844
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5693
5845
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5912,9 +6064,9 @@ class RouterLinkActive {
|
|
|
5912
6064
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5913
6065
|
}
|
|
5914
6066
|
}
|
|
5915
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5916
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.
|
|
5917
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6067
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
|
|
6068
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", 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 });
|
|
6069
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5918
6070
|
type: Directive,
|
|
5919
6071
|
args: [{
|
|
5920
6072
|
selector: '[routerLinkActive]',
|
|
@@ -5946,90 +6098,6 @@ function isActiveMatchOptions(options) {
|
|
|
5946
6098
|
return !!options.paths;
|
|
5947
6099
|
}
|
|
5948
6100
|
|
|
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
6101
|
/**
|
|
6034
6102
|
* @license
|
|
6035
6103
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6062,9 +6130,9 @@ class PreloadAllModules {
|
|
|
6062
6130
|
return fn().pipe(catchError(() => of(null)));
|
|
6063
6131
|
}
|
|
6064
6132
|
}
|
|
6065
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6066
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6067
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6133
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6134
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6068
6136
|
type: Injectable,
|
|
6069
6137
|
args: [{ providedIn: 'root' }]
|
|
6070
6138
|
}] });
|
|
@@ -6082,9 +6150,9 @@ class NoPreloading {
|
|
|
6082
6150
|
return of(null);
|
|
6083
6151
|
}
|
|
6084
6152
|
}
|
|
6085
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6086
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6087
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6153
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6154
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6088
6156
|
type: Injectable,
|
|
6089
6157
|
args: [{ providedIn: 'root' }]
|
|
6090
6158
|
}] });
|
|
@@ -6131,7 +6199,15 @@ class RouterPreloader {
|
|
|
6131
6199
|
}
|
|
6132
6200
|
const injectorForCurrentRoute = route._injector ?? injector;
|
|
6133
6201
|
const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;
|
|
6134
|
-
|
|
6202
|
+
// Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not
|
|
6203
|
+
// `loadComponent`. `canLoad` guards only block loading of child routes by design. This
|
|
6204
|
+
// happens as a consequence of needing to descend into children for route matching immediately
|
|
6205
|
+
// while component loading is deferred until route activation. Because `canLoad` guards can
|
|
6206
|
+
// have side effects, we cannot execute them here so we instead skip preloading altogether
|
|
6207
|
+
// when present. Lastly, it remains to be decided whether `canLoad` should behave this way
|
|
6208
|
+
// at all. Code splitting and lazy loading is separate from client-side authorization checks
|
|
6209
|
+
// and should not be used as a security measure to prevent loading of code.
|
|
6210
|
+
if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||
|
|
6135
6211
|
(route.loadComponent && !route._loadedComponent)) {
|
|
6136
6212
|
res.push(this.preloadConfig(injectorForCurrentRoute, route));
|
|
6137
6213
|
}
|
|
@@ -6170,9 +6246,9 @@ class RouterPreloader {
|
|
|
6170
6246
|
});
|
|
6171
6247
|
}
|
|
6172
6248
|
}
|
|
6173
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6174
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6175
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6249
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6250
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterPreloader });
|
|
6251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6176
6252
|
type: Injectable
|
|
6177
6253
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6178
6254
|
|
|
@@ -6259,9 +6335,9 @@ class RouterScroller {
|
|
|
6259
6335
|
}
|
|
6260
6336
|
}
|
|
6261
6337
|
}
|
|
6262
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6263
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6264
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6338
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6339
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterScroller });
|
|
6340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6265
6341
|
type: Injectable
|
|
6266
6342
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6267
6343
|
|
|
@@ -6277,36 +6353,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
|
6277
6353
|
* The directives defined in the `RouterModule`.
|
|
6278
6354
|
*/
|
|
6279
6355
|
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
6356
|
/**
|
|
6290
6357
|
* @docsNotRequired
|
|
6291
6358
|
*/
|
|
6292
6359
|
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6293
6360
|
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6361
|
+
// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
|
|
6362
|
+
// here to avoid a breaking change whereby the provider order matters based on where the
|
|
6363
|
+
// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
|
|
6364
|
+
// change in a major version.
|
|
6294
6365
|
const ROUTER_PROVIDERS = [
|
|
6295
6366
|
Location,
|
|
6296
6367
|
{ 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
|
-
},
|
|
6368
|
+
{ provide: Router, useFactory: setupRouter },
|
|
6306
6369
|
ChildrenOutletContexts,
|
|
6307
6370
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6308
6371
|
RouterConfigLoader,
|
|
6309
6372
|
];
|
|
6373
|
+
function rootRoute(router) {
|
|
6374
|
+
return router.routerState.root;
|
|
6375
|
+
}
|
|
6310
6376
|
function routerNgProbeToken() {
|
|
6311
6377
|
return new NgProbeToken('Router', Router);
|
|
6312
6378
|
}
|
|
@@ -6332,8 +6398,7 @@ function routerNgProbeToken() {
|
|
|
6332
6398
|
* @publicApi
|
|
6333
6399
|
*/
|
|
6334
6400
|
class RouterModule {
|
|
6335
|
-
|
|
6336
|
-
constructor(guard, router) { }
|
|
6401
|
+
constructor(guard) { }
|
|
6337
6402
|
/**
|
|
6338
6403
|
* Creates and configures a module with all the router providers and directives.
|
|
6339
6404
|
* Optionally sets up an application listener to perform an initial navigation.
|
|
@@ -6394,10 +6459,10 @@ class RouterModule {
|
|
|
6394
6459
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6395
6460
|
}
|
|
6396
6461
|
}
|
|
6397
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6398
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.
|
|
6399
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.
|
|
6400
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6462
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6463
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6464
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterModule });
|
|
6465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterModule, decorators: [{
|
|
6401
6466
|
type: NgModule,
|
|
6402
6467
|
args: [{
|
|
6403
6468
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6408,8 +6473,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
6408
6473
|
}, {
|
|
6409
6474
|
type: Inject,
|
|
6410
6475
|
args: [ROUTER_FORROOT_GUARD]
|
|
6411
|
-
}] }, { type: Router, decorators: [{
|
|
6412
|
-
type: Optional
|
|
6413
6476
|
}] }]; } });
|
|
6414
6477
|
function provideRouterScroller() {
|
|
6415
6478
|
return {
|
|
@@ -6455,48 +6518,9 @@ function provideForRootGuard(router) {
|
|
|
6455
6518
|
*/
|
|
6456
6519
|
function provideRoutes(routes) {
|
|
6457
6520
|
return [
|
|
6458
|
-
{ provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
|
|
6459
6521
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6460
6522
|
];
|
|
6461
6523
|
}
|
|
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
6524
|
function getBootstrapListener() {
|
|
6501
6525
|
const injector = inject(Injector);
|
|
6502
6526
|
return (bootstrappedComponentRef) => {
|
|
@@ -6506,8 +6530,7 @@ function getBootstrapListener() {
|
|
|
6506
6530
|
}
|
|
6507
6531
|
const router = injector.get(Router);
|
|
6508
6532
|
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6509
|
-
|
|
6510
|
-
if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
|
|
6533
|
+
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6511
6534
|
router.initialNavigation();
|
|
6512
6535
|
}
|
|
6513
6536
|
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
@@ -6551,7 +6574,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
|
|
|
6551
6574
|
});
|
|
6552
6575
|
function provideEnabledBlockingInitialNavigation() {
|
|
6553
6576
|
return [
|
|
6554
|
-
{ provide: INITIAL_NAVIGATION, useValue:
|
|
6577
|
+
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6555
6578
|
{
|
|
6556
6579
|
provide: APP_INITIALIZER,
|
|
6557
6580
|
multi: true,
|
|
@@ -6617,7 +6640,7 @@ function provideEnabledBlockingInitialNavigation() {
|
|
|
6617
6640
|
},
|
|
6618
6641
|
];
|
|
6619
6642
|
}
|
|
6620
|
-
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
|
|
6643
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6621
6644
|
function provideDisabledInitialNavigation() {
|
|
6622
6645
|
return [
|
|
6623
6646
|
{
|
|
@@ -6630,7 +6653,7 @@ function provideDisabledInitialNavigation() {
|
|
|
6630
6653
|
};
|
|
6631
6654
|
}
|
|
6632
6655
|
},
|
|
6633
|
-
{ provide: INITIAL_NAVIGATION, useValue:
|
|
6656
|
+
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6634
6657
|
];
|
|
6635
6658
|
}
|
|
6636
6659
|
function provideTracing() {
|
|
@@ -6673,7 +6696,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6673
6696
|
/**
|
|
6674
6697
|
* @publicApi
|
|
6675
6698
|
*/
|
|
6676
|
-
const VERSION = new Version('14.1.
|
|
6699
|
+
const VERSION = new Version('14.1.1');
|
|
6677
6700
|
|
|
6678
6701
|
/**
|
|
6679
6702
|
* @license
|