@angular/router 14.1.0-rc.0 → 14.1.2
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/apply_redirects.mjs +4 -3
- 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/operators/recognize.mjs +1 -1
- package/esm2020/src/operators/resolve_data.mjs +4 -3
- package/esm2020/src/page_title_strategy.mjs +11 -5
- package/esm2020/src/private_export.mjs +3 -2
- package/esm2020/src/recognize.mjs +4 -3
- package/esm2020/src/router.mjs +128 -72
- package/esm2020/src/router_config.mjs +19 -0
- package/esm2020/src/router_config_loader.mjs +6 -5
- package/esm2020/src/router_module.mjs +21 -78
- package/esm2020/src/router_outlet_context.mjs +9 -1
- package/esm2020/src/router_preloader.mjs +19 -11
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/url_tree.mjs +9 -2
- package/esm2020/src/utils/type_guards.mjs +5 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +10 -12
- package/fesm2015/router.mjs +332 -276
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +10 -12
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +326 -278
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +10 -12
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +10 -7
- package/package.json +4 -4
- package/testing/index.d.ts +2 -3
- package/upgrade/index.d.ts +1 -1
package/fesm2020/router.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.
|
|
2
|
+
* @license Angular v14.1.2
|
|
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,
|
|
9
|
-
import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, 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,
|
|
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
|
|
|
@@ -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
|
}
|
|
@@ -439,6 +439,12 @@ function mapChildrenIntoArray(segment, fn) {
|
|
|
439
439
|
*/
|
|
440
440
|
class UrlSerializer {
|
|
441
441
|
}
|
|
442
|
+
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
443
|
+
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
|
|
444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: UrlSerializer, decorators: [{
|
|
445
|
+
type: Injectable,
|
|
446
|
+
args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
|
|
447
|
+
}] });
|
|
442
448
|
/**
|
|
443
449
|
* @description
|
|
444
450
|
*
|
|
@@ -647,7 +653,7 @@ class UrlParser {
|
|
|
647
653
|
parseSegment() {
|
|
648
654
|
const path = matchSegments(this.remaining);
|
|
649
655
|
if (path === '' && this.peekStartsWith(';')) {
|
|
650
|
-
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$
|
|
656
|
+
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
|
|
651
657
|
}
|
|
652
658
|
this.capture(path);
|
|
653
659
|
return new UrlSegment(decode(path), this.parseMatrixParams());
|
|
@@ -716,7 +722,7 @@ class UrlParser {
|
|
|
716
722
|
// if is is not one of these characters, then the segment was unescaped
|
|
717
723
|
// or the group was not closed
|
|
718
724
|
if (next !== '/' && next !== ')' && next !== ';') {
|
|
719
|
-
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$
|
|
725
|
+
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
|
|
720
726
|
}
|
|
721
727
|
let outletName = undefined;
|
|
722
728
|
if (path.indexOf(':') > -1) {
|
|
@@ -747,7 +753,7 @@ class UrlParser {
|
|
|
747
753
|
}
|
|
748
754
|
capture(str) {
|
|
749
755
|
if (!this.consumeOptional(str)) {
|
|
750
|
-
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$
|
|
756
|
+
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
|
|
751
757
|
}
|
|
752
758
|
}
|
|
753
759
|
}
|
|
@@ -800,7 +806,7 @@ function isUrlTree(v) {
|
|
|
800
806
|
* Use of this source code is governed by an MIT-style license that can be
|
|
801
807
|
* found in the LICENSE file at https://angular.io/license
|
|
802
808
|
*/
|
|
803
|
-
const NG_DEV_MODE$
|
|
809
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
804
810
|
/**
|
|
805
811
|
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
806
812
|
*
|
|
@@ -976,11 +982,11 @@ class Navigation {
|
|
|
976
982
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
977
983
|
this.commands = commands;
|
|
978
984
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
979
|
-
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$
|
|
985
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
|
|
980
986
|
}
|
|
981
987
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
982
988
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
983
|
-
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$
|
|
989
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
|
|
984
990
|
}
|
|
985
991
|
}
|
|
986
992
|
toRoot() {
|
|
@@ -1079,7 +1085,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1079
1085
|
dd -= ci;
|
|
1080
1086
|
g = g.parent;
|
|
1081
1087
|
if (!g) {
|
|
1082
|
-
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$
|
|
1088
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
|
|
1083
1089
|
}
|
|
1084
1090
|
ci = g.segments.length;
|
|
1085
1091
|
}
|
|
@@ -2352,6 +2358,12 @@ class ChildrenOutletContexts {
|
|
|
2352
2358
|
return this.contexts.get(childName) || null;
|
|
2353
2359
|
}
|
|
2354
2360
|
}
|
|
2361
|
+
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2362
|
+
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
|
|
2363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
2364
|
+
type: Injectable,
|
|
2365
|
+
args: [{ providedIn: 'root' }]
|
|
2366
|
+
}] });
|
|
2355
2367
|
|
|
2356
2368
|
/**
|
|
2357
2369
|
* @license
|
|
@@ -2360,7 +2372,7 @@ class ChildrenOutletContexts {
|
|
|
2360
2372
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2361
2373
|
* found in the LICENSE file at https://angular.io/license
|
|
2362
2374
|
*/
|
|
2363
|
-
const NG_DEV_MODE$
|
|
2375
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2364
2376
|
/**
|
|
2365
2377
|
* @description
|
|
2366
2378
|
*
|
|
@@ -2469,12 +2481,12 @@ class RouterOutlet {
|
|
|
2469
2481
|
*/
|
|
2470
2482
|
get component() {
|
|
2471
2483
|
if (!this.activated)
|
|
2472
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2484
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
|
|
2473
2485
|
return this.activated.instance;
|
|
2474
2486
|
}
|
|
2475
2487
|
get activatedRoute() {
|
|
2476
2488
|
if (!this.activated)
|
|
2477
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2489
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
|
|
2478
2490
|
return this._activatedRoute;
|
|
2479
2491
|
}
|
|
2480
2492
|
get activatedRouteData() {
|
|
@@ -2488,7 +2500,7 @@ class RouterOutlet {
|
|
|
2488
2500
|
*/
|
|
2489
2501
|
detach() {
|
|
2490
2502
|
if (!this.activated)
|
|
2491
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2503
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
|
|
2492
2504
|
this.location.detach();
|
|
2493
2505
|
const cmp = this.activated;
|
|
2494
2506
|
this.activated = null;
|
|
@@ -2516,7 +2528,7 @@ class RouterOutlet {
|
|
|
2516
2528
|
}
|
|
2517
2529
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2518
2530
|
if (this.isActivated) {
|
|
2519
|
-
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$
|
|
2531
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
|
|
2520
2532
|
}
|
|
2521
2533
|
this._activatedRoute = activatedRoute;
|
|
2522
2534
|
const location = this.location;
|
|
@@ -2538,9 +2550,9 @@ class RouterOutlet {
|
|
|
2538
2550
|
this.activateEvents.emit(this.activated.instance);
|
|
2539
2551
|
}
|
|
2540
2552
|
}
|
|
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.
|
|
2553
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2554
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2555
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2544
2556
|
type: Directive,
|
|
2545
2557
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2546
2558
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
@@ -2597,9 +2609,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2597
2609
|
*/
|
|
2598
2610
|
class ɵEmptyOutletComponent {
|
|
2599
2611
|
}
|
|
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.
|
|
2612
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2613
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", 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"] }] });
|
|
2614
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2603
2615
|
type: Component,
|
|
2604
2616
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2605
2617
|
}] });
|
|
@@ -3156,6 +3168,9 @@ function isRedirectingNavigationCancelingError(error) {
|
|
|
3156
3168
|
function isNavigationCancelingError(error) {
|
|
3157
3169
|
return error && error[NAVIGATION_CANCELING_ERROR];
|
|
3158
3170
|
}
|
|
3171
|
+
function isEmptyError(e) {
|
|
3172
|
+
return e instanceof EmptyError || e?.name === 'EmptyError';
|
|
3173
|
+
}
|
|
3159
3174
|
|
|
3160
3175
|
/**
|
|
3161
3176
|
* @license
|
|
@@ -3493,7 +3508,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3493
3508
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3494
3509
|
* found in the LICENSE file at https://angular.io/license
|
|
3495
3510
|
*/
|
|
3496
|
-
const NG_DEV_MODE$
|
|
3511
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3497
3512
|
class NoMatch$1 {
|
|
3498
3513
|
constructor(segmentGroup) {
|
|
3499
3514
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3511,11 +3526,11 @@ function absoluteRedirect(newTree) {
|
|
|
3511
3526
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3512
3527
|
}
|
|
3513
3528
|
function namedOutletsRedirect(redirectTo) {
|
|
3514
|
-
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$
|
|
3529
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
|
|
3515
3530
|
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3516
3531
|
}
|
|
3517
3532
|
function canLoadFails(route) {
|
|
3518
|
-
return throwError(navigationCancelingError(NG_DEV_MODE$
|
|
3533
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
|
|
3519
3534
|
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3520
3535
|
}
|
|
3521
3536
|
/**
|
|
@@ -3575,7 +3590,7 @@ class ApplyRedirects {
|
|
|
3575
3590
|
}));
|
|
3576
3591
|
}
|
|
3577
3592
|
noMatchError(e) {
|
|
3578
|
-
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$
|
|
3593
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3579
3594
|
}
|
|
3580
3595
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3581
3596
|
const root = createRoot(rootCandidate);
|
|
@@ -3625,7 +3640,7 @@ class ApplyRedirects {
|
|
|
3625
3640
|
throw e;
|
|
3626
3641
|
}));
|
|
3627
3642
|
}), first((s) => !!s), catchError((e, _) => {
|
|
3628
|
-
if (e
|
|
3643
|
+
if (isEmptyError(e)) {
|
|
3629
3644
|
if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
|
|
3630
3645
|
return of(new UrlSegmentGroup([], {}));
|
|
3631
3646
|
}
|
|
@@ -3790,7 +3805,7 @@ class ApplyRedirects {
|
|
|
3790
3805
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3791
3806
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3792
3807
|
if (!pos)
|
|
3793
|
-
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$
|
|
3808
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
|
|
3794
3809
|
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3795
3810
|
return pos;
|
|
3796
3811
|
}
|
|
@@ -3826,7 +3841,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
|
|
|
3826
3841
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3827
3842
|
* found in the LICENSE file at https://angular.io/license
|
|
3828
3843
|
*/
|
|
3829
|
-
const NG_DEV_MODE$
|
|
3844
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3830
3845
|
class NoMatch {
|
|
3831
3846
|
}
|
|
3832
3847
|
function newObservableError(e) {
|
|
@@ -3915,7 +3930,7 @@ class Recognizer {
|
|
|
3915
3930
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3916
3931
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3917
3932
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3918
|
-
if (NG_DEV_MODE$
|
|
3933
|
+
if (NG_DEV_MODE$4) {
|
|
3919
3934
|
// This should really never happen - we are only taking the first match for each
|
|
3920
3935
|
// outlet and merge the empty path matches.
|
|
3921
3936
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -3928,7 +3943,7 @@ class Recognizer {
|
|
|
3928
3943
|
return from(routes).pipe(concatMap(r => {
|
|
3929
3944
|
return this.processSegmentAgainstRoute(r._injector ?? injector, r, segmentGroup, segments, outlet);
|
|
3930
3945
|
}), first((x) => !!x), catchError(e => {
|
|
3931
|
-
if (e
|
|
3946
|
+
if (isEmptyError(e)) {
|
|
3932
3947
|
if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
|
|
3933
3948
|
return of([]);
|
|
3934
3949
|
}
|
|
@@ -3948,7 +3963,7 @@ class Recognizer {
|
|
|
3948
3963
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3949
3964
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3950
3965
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3951
|
-
(NG_DEV_MODE$
|
|
3966
|
+
(NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3952
3967
|
pathIndexShift));
|
|
3953
3968
|
matchResult = of({
|
|
3954
3969
|
snapshot,
|
|
@@ -3964,7 +3979,7 @@ class Recognizer {
|
|
|
3964
3979
|
return null;
|
|
3965
3980
|
}
|
|
3966
3981
|
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$
|
|
3982
|
+
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
3983
|
getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3969
3984
|
pathIndexShift));
|
|
3970
3985
|
return { snapshot, consumedSegments, remainingSegments };
|
|
@@ -4077,7 +4092,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4077
4092
|
if (routeWithSameOutletName) {
|
|
4078
4093
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4079
4094
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4080
|
-
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$
|
|
4095
|
+
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
4096
|
}
|
|
4082
4097
|
names[n.value.outlet] = n.value;
|
|
4083
4098
|
});
|
|
@@ -4175,7 +4190,7 @@ function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
|
|
|
4175
4190
|
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, moduleInjector)
|
|
4176
4191
|
.pipe(first(), tap((value) => {
|
|
4177
4192
|
data[key] = value;
|
|
4178
|
-
}))), takeLast(1), mapTo(data), catchError((e) => e
|
|
4193
|
+
}))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
|
|
4179
4194
|
}
|
|
4180
4195
|
function getDataKeys(obj) {
|
|
4181
4196
|
return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
|
|
@@ -4212,6 +4227,90 @@ function switchTap(next) {
|
|
|
4212
4227
|
});
|
|
4213
4228
|
}
|
|
4214
4229
|
|
|
4230
|
+
/**
|
|
4231
|
+
* @license
|
|
4232
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4233
|
+
*
|
|
4234
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4235
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4236
|
+
*/
|
|
4237
|
+
/**
|
|
4238
|
+
* Provides a strategy for setting the page title after a router navigation.
|
|
4239
|
+
*
|
|
4240
|
+
* The built-in implementation traverses the router state snapshot and finds the deepest primary
|
|
4241
|
+
* outlet with `title` property. Given the `Routes` below, navigating to
|
|
4242
|
+
* `/base/child(popup:aux)` would result in the document title being set to "child".
|
|
4243
|
+
* ```
|
|
4244
|
+
* [
|
|
4245
|
+
* {path: 'base', title: 'base', children: [
|
|
4246
|
+
* {path: 'child', title: 'child'},
|
|
4247
|
+
* ],
|
|
4248
|
+
* {path: 'aux', outlet: 'popup', title: 'popupTitle'}
|
|
4249
|
+
* ]
|
|
4250
|
+
* ```
|
|
4251
|
+
*
|
|
4252
|
+
* This class can be used as a base class for custom title strategies. That is, you can create your
|
|
4253
|
+
* own class that extends the `TitleStrategy`. Note that in the above example, the `title`
|
|
4254
|
+
* from the named outlet is never used. However, a custom strategy might be implemented to
|
|
4255
|
+
* incorporate titles in named outlets.
|
|
4256
|
+
*
|
|
4257
|
+
* @publicApi
|
|
4258
|
+
* @see [Page title guide](guide/router#setting-the-page-title)
|
|
4259
|
+
*/
|
|
4260
|
+
class TitleStrategy {
|
|
4261
|
+
/**
|
|
4262
|
+
* @returns The `title` of the deepest primary route.
|
|
4263
|
+
*/
|
|
4264
|
+
buildTitle(snapshot) {
|
|
4265
|
+
let pageTitle;
|
|
4266
|
+
let route = snapshot.root;
|
|
4267
|
+
while (route !== undefined) {
|
|
4268
|
+
pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
|
|
4269
|
+
route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
|
|
4270
|
+
}
|
|
4271
|
+
return pageTitle;
|
|
4272
|
+
}
|
|
4273
|
+
/**
|
|
4274
|
+
* Given an `ActivatedRouteSnapshot`, returns the final value of the
|
|
4275
|
+
* `Route.title` property, which can either be a static string or a resolved value.
|
|
4276
|
+
*/
|
|
4277
|
+
getResolvedTitleForRoute(snapshot) {
|
|
4278
|
+
return snapshot.data[RouteTitle];
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4282
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4284
|
+
type: Injectable,
|
|
4285
|
+
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4286
|
+
}] });
|
|
4287
|
+
/**
|
|
4288
|
+
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
4289
|
+
*/
|
|
4290
|
+
class DefaultTitleStrategy extends TitleStrategy {
|
|
4291
|
+
constructor(title) {
|
|
4292
|
+
super();
|
|
4293
|
+
this.title = title;
|
|
4294
|
+
}
|
|
4295
|
+
/**
|
|
4296
|
+
* Sets the title of the browser to the given value.
|
|
4297
|
+
*
|
|
4298
|
+
* @param title The `pageTitle` from the deepest primary route.
|
|
4299
|
+
*/
|
|
4300
|
+
updateTitle(snapshot) {
|
|
4301
|
+
const title = this.buildTitle(snapshot);
|
|
4302
|
+
if (title !== undefined) {
|
|
4303
|
+
this.title.setTitle(title);
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4308
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4310
|
+
type: Injectable,
|
|
4311
|
+
args: [{ providedIn: 'root' }]
|
|
4312
|
+
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
4313
|
+
|
|
4215
4314
|
/**
|
|
4216
4315
|
* @license
|
|
4217
4316
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4277,6 +4376,24 @@ class BaseRouteReuseStrategy {
|
|
|
4277
4376
|
class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
4278
4377
|
}
|
|
4279
4378
|
|
|
4379
|
+
/**
|
|
4380
|
+
* @license
|
|
4381
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4382
|
+
*
|
|
4383
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4384
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4385
|
+
*/
|
|
4386
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4387
|
+
/**
|
|
4388
|
+
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
4389
|
+
*
|
|
4390
|
+
* @publicApi
|
|
4391
|
+
*/
|
|
4392
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
|
|
4393
|
+
providedIn: 'root',
|
|
4394
|
+
factory: () => ({}),
|
|
4395
|
+
});
|
|
4396
|
+
|
|
4280
4397
|
/**
|
|
4281
4398
|
* @license
|
|
4282
4399
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4383,10 +4500,11 @@ class RouterConfigLoader {
|
|
|
4383
4500
|
}));
|
|
4384
4501
|
}
|
|
4385
4502
|
}
|
|
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.
|
|
4389
|
-
type: Injectable
|
|
4503
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4504
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4505
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4506
|
+
type: Injectable,
|
|
4507
|
+
args: [{ providedIn: 'root' }]
|
|
4390
4508
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4391
4509
|
|
|
4392
4510
|
/**
|
|
@@ -4454,6 +4572,52 @@ const subsetMatchOptions = {
|
|
|
4454
4572
|
matrixParams: 'ignored',
|
|
4455
4573
|
queryParams: 'subset'
|
|
4456
4574
|
};
|
|
4575
|
+
function assignExtraOptionsToRouter(opts, router) {
|
|
4576
|
+
if (opts.errorHandler) {
|
|
4577
|
+
router.errorHandler = opts.errorHandler;
|
|
4578
|
+
}
|
|
4579
|
+
if (opts.malformedUriErrorHandler) {
|
|
4580
|
+
router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
|
|
4581
|
+
}
|
|
4582
|
+
if (opts.onSameUrlNavigation) {
|
|
4583
|
+
router.onSameUrlNavigation = opts.onSameUrlNavigation;
|
|
4584
|
+
}
|
|
4585
|
+
if (opts.paramsInheritanceStrategy) {
|
|
4586
|
+
router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
|
4587
|
+
}
|
|
4588
|
+
if (opts.relativeLinkResolution) {
|
|
4589
|
+
router.relativeLinkResolution = opts.relativeLinkResolution;
|
|
4590
|
+
}
|
|
4591
|
+
if (opts.urlUpdateStrategy) {
|
|
4592
|
+
router.urlUpdateStrategy = opts.urlUpdateStrategy;
|
|
4593
|
+
}
|
|
4594
|
+
if (opts.canceledNavigationResolution) {
|
|
4595
|
+
router.canceledNavigationResolution = opts.canceledNavigationResolution;
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
function setupRouter() {
|
|
4599
|
+
const urlSerializer = inject(UrlSerializer);
|
|
4600
|
+
const contexts = inject(ChildrenOutletContexts);
|
|
4601
|
+
const location = inject(Location);
|
|
4602
|
+
const injector = inject(Injector);
|
|
4603
|
+
const compiler = inject(Compiler);
|
|
4604
|
+
const config = inject(ROUTES, { optional: true }) ?? [];
|
|
4605
|
+
const opts = inject(ROUTER_CONFIGURATION, { optional: true }) ?? {};
|
|
4606
|
+
const defaultTitleStrategy = inject(DefaultTitleStrategy);
|
|
4607
|
+
const titleStrategy = inject(TitleStrategy, { optional: true });
|
|
4608
|
+
const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
|
|
4609
|
+
const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
|
|
4610
|
+
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
4611
|
+
if (urlHandlingStrategy) {
|
|
4612
|
+
router.urlHandlingStrategy = urlHandlingStrategy;
|
|
4613
|
+
}
|
|
4614
|
+
if (routeReuseStrategy) {
|
|
4615
|
+
router.routeReuseStrategy = routeReuseStrategy;
|
|
4616
|
+
}
|
|
4617
|
+
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
4618
|
+
assignExtraOptionsToRouter(opts, router);
|
|
4619
|
+
return router;
|
|
4620
|
+
}
|
|
4457
4621
|
/**
|
|
4458
4622
|
* @description
|
|
4459
4623
|
*
|
|
@@ -4642,10 +4806,11 @@ class Router {
|
|
|
4642
4806
|
// Extract URL
|
|
4643
4807
|
map(t => ({ ...t, extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) })),
|
|
4644
4808
|
// Using switchMap so we cancel executing navigations when a new one comes in
|
|
4645
|
-
switchMap(
|
|
4809
|
+
switchMap(overallTransitionState => {
|
|
4646
4810
|
let completed = false;
|
|
4647
4811
|
let errored = false;
|
|
4648
|
-
return of(
|
|
4812
|
+
return of(overallTransitionState)
|
|
4813
|
+
.pipe(
|
|
4649
4814
|
// Store the Navigation object
|
|
4650
4815
|
tap(t => {
|
|
4651
4816
|
this.currentNavigation = {
|
|
@@ -4664,8 +4829,8 @@ class Router {
|
|
|
4664
4829
|
t.extractedUrl.toString() !== browserUrlTree ||
|
|
4665
4830
|
// Navigations which succeed or ones which fail and are cleaned up
|
|
4666
4831
|
// correctly should result in `browserUrlTree` and `currentUrlTree`
|
|
4667
|
-
// matching. If this is not the case, assume something went wrong and
|
|
4668
|
-
// processing the URL again.
|
|
4832
|
+
// matching. If this is not the case, assume something went wrong and
|
|
4833
|
+
// try processing the URL again.
|
|
4669
4834
|
browserUrlTree !== this.currentUrlTree.toString();
|
|
4670
4835
|
const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
|
|
4671
4836
|
this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
|
|
@@ -4696,11 +4861,13 @@ class Router {
|
|
|
4696
4861
|
...this.currentNavigation,
|
|
4697
4862
|
finalUrl: t.urlAfterRedirects
|
|
4698
4863
|
};
|
|
4864
|
+
overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
|
|
4699
4865
|
}),
|
|
4700
4866
|
// Recognize
|
|
4701
4867
|
recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy, this.relativeLinkResolution),
|
|
4702
4868
|
// Update URL if in `eager` update mode
|
|
4703
4869
|
tap(t => {
|
|
4870
|
+
overallTransitionState.targetSnapshot = t.targetSnapshot;
|
|
4704
4871
|
if (this.urlUpdateStrategy === 'eager') {
|
|
4705
4872
|
if (!t.extras.skipLocationChange) {
|
|
4706
4873
|
const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
|
|
@@ -4716,26 +4883,27 @@ class Router {
|
|
|
4716
4883
|
else {
|
|
4717
4884
|
const processPreviousUrl = urlTransition && this.rawUrlTree &&
|
|
4718
4885
|
this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
|
|
4719
|
-
/* When the current URL shouldn't be processed, but the previous one
|
|
4720
|
-
* we handle this "error condition" by navigating to the
|
|
4721
|
-
* successful URL, but leaving the URL intact.*/
|
|
4886
|
+
/* When the current URL shouldn't be processed, but the previous one
|
|
4887
|
+
* was, we handle this "error condition" by navigating to the
|
|
4888
|
+
* previously successful URL, but leaving the URL intact.*/
|
|
4722
4889
|
if (processPreviousUrl) {
|
|
4723
4890
|
const { id, extractedUrl, source, restoredState, extras } = t;
|
|
4724
4891
|
const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
|
|
4725
4892
|
eventsSubject.next(navStart);
|
|
4726
4893
|
const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
|
|
4727
|
-
|
|
4894
|
+
overallTransitionState = {
|
|
4728
4895
|
...t,
|
|
4729
4896
|
targetSnapshot,
|
|
4730
4897
|
urlAfterRedirects: extractedUrl,
|
|
4731
4898
|
extras: { ...extras, skipLocationChange: false, replaceUrl: false },
|
|
4732
|
-
}
|
|
4899
|
+
};
|
|
4900
|
+
return of(overallTransitionState);
|
|
4733
4901
|
}
|
|
4734
4902
|
else {
|
|
4735
|
-
/* When neither the current or previous URL can be processed, do
|
|
4736
|
-
* other than update router's internal reference to the
|
|
4737
|
-
* URL. This way the next navigation will be coming
|
|
4738
|
-
* in the browser.
|
|
4903
|
+
/* When neither the current or previous URL can be processed, do
|
|
4904
|
+
* nothing other than update router's internal reference to the
|
|
4905
|
+
* current "settled" URL. This way the next navigation will be coming
|
|
4906
|
+
* from the current URL in the browser.
|
|
4739
4907
|
*/
|
|
4740
4908
|
this.rawUrlTree = t.rawUrl;
|
|
4741
4909
|
t.resolve(null);
|
|
@@ -4747,10 +4915,14 @@ class Router {
|
|
|
4747
4915
|
tap(t => {
|
|
4748
4916
|
const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
|
4749
4917
|
this.triggerEvent(guardsStart);
|
|
4750
|
-
}), map(t =>
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4918
|
+
}), map(t => {
|
|
4919
|
+
overallTransitionState = {
|
|
4920
|
+
...t,
|
|
4921
|
+
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
|
|
4922
|
+
};
|
|
4923
|
+
return overallTransitionState;
|
|
4924
|
+
}), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
|
|
4925
|
+
overallTransitionState.guardsResult = t.guardsResult;
|
|
4754
4926
|
if (isUrlTree(t.guardsResult)) {
|
|
4755
4927
|
throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
|
|
4756
4928
|
}
|
|
@@ -4810,13 +4982,14 @@ class Router {
|
|
|
4810
4982
|
.pipe(defaultIfEmpty(), take(1));
|
|
4811
4983
|
}), switchTap(() => this.afterPreactivation()), map((t) => {
|
|
4812
4984
|
const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4813
|
-
|
|
4985
|
+
overallTransitionState = { ...t, targetRouterState };
|
|
4986
|
+
return (overallTransitionState);
|
|
4814
4987
|
}),
|
|
4815
|
-
/* Once here, we are about to activate synchronously. The assumption is
|
|
4816
|
-
will succeed, and user code may read from the Router service.
|
|
4817
|
-
before activation, we need to update router properties storing
|
|
4818
|
-
URL and the RouterState, as well as updated the browser URL.
|
|
4819
|
-
happen *before* activating. */
|
|
4988
|
+
/* Once here, we are about to activate synchronously. The assumption is
|
|
4989
|
+
this will succeed, and user code may read from the Router service.
|
|
4990
|
+
Therefore before activation, we need to update router properties storing
|
|
4991
|
+
the current URL and the RouterState, as well as updated the browser URL.
|
|
4992
|
+
All this should happen *before* activating. */
|
|
4820
4993
|
tap((t) => {
|
|
4821
4994
|
this.currentUrlTree = t.urlAfterRedirects;
|
|
4822
4995
|
this.rawUrlTree =
|
|
@@ -4836,81 +5009,75 @@ class Router {
|
|
|
4836
5009
|
completed = true;
|
|
4837
5010
|
}
|
|
4838
5011
|
}), finalize(() => {
|
|
4839
|
-
/* When the navigation stream finishes either through error or success,
|
|
4840
|
-
* set the `completed` or `errored` flag. However, there are some
|
|
4841
|
-
* where we could get here without either of those being set.
|
|
4842
|
-
* redirect during NavigationStart. Therefore, this is a
|
|
4843
|
-
* sure the NavigationCancel
|
|
4844
|
-
*
|
|
4845
|
-
* means. */
|
|
5012
|
+
/* When the navigation stream finishes either through error or success,
|
|
5013
|
+
* we set the `completed` or `errored` flag. However, there are some
|
|
5014
|
+
* situations where we could get here without either of those being set.
|
|
5015
|
+
* For instance, a redirect during NavigationStart. Therefore, this is a
|
|
5016
|
+
* catch-all to make sure the NavigationCancel event is fired when a
|
|
5017
|
+
* navigation gets cancelled but not caught by other means. */
|
|
4846
5018
|
if (!completed && !errored) {
|
|
4847
5019
|
const cancelationReason = NG_DEV_MODE$1 ?
|
|
4848
|
-
`Navigation ID ${
|
|
5020
|
+
`Navigation ID ${overallTransitionState
|
|
5021
|
+
.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
4849
5022
|
'';
|
|
4850
|
-
this.cancelNavigationTransition(
|
|
5023
|
+
this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
|
|
4851
5024
|
}
|
|
4852
5025
|
// Only clear current navigation if it is still set to the one that
|
|
4853
5026
|
// finalized.
|
|
4854
|
-
if (this.currentNavigation?.id ===
|
|
5027
|
+
if (this.currentNavigation?.id === overallTransitionState.id) {
|
|
4855
5028
|
this.currentNavigation = null;
|
|
4856
5029
|
}
|
|
4857
5030
|
}), catchError((e) => {
|
|
4858
|
-
// TODO(atscott): The NavigationTransition `t` used here does not accurately
|
|
4859
|
-
// reflect the current state of the whole transition because some operations
|
|
4860
|
-
// return a new object rather than modifying the one in the outermost
|
|
4861
|
-
// `switchMap`.
|
|
4862
|
-
// The fix can likely be to:
|
|
4863
|
-
// 1. Rename the outer `t` variable so it's not shadowed all the time and
|
|
4864
|
-
// confusing
|
|
4865
|
-
// 2. Keep reassigning to the outer variable after each stage to ensure it
|
|
4866
|
-
// gets updated. Or change the implementations to not return a copy.
|
|
4867
|
-
// Not changed yet because it affects existing code and would need to be
|
|
4868
|
-
// tested more thoroughly.
|
|
4869
5031
|
errored = true;
|
|
4870
5032
|
/* This error type is issued during Redirect, and is handled as a
|
|
4871
5033
|
* cancellation rather than an error. */
|
|
4872
5034
|
if (isNavigationCancelingError$1(e)) {
|
|
4873
5035
|
if (!isRedirectingNavigationCancelingError$1(e)) {
|
|
4874
|
-
// Set property only if we're not redirecting. If we landed on a page
|
|
4875
|
-
// redirect to `/` route, the new navigation is going to see the
|
|
4876
|
-
// isn't a change from the default currentUrlTree and won't
|
|
4877
|
-
// This is only applicable with initial navigation, so
|
|
4878
|
-
// `navigated` only when not redirecting resolves this
|
|
5036
|
+
// Set property only if we're not redirecting. If we landed on a page
|
|
5037
|
+
// and redirect to `/` route, the new navigation is going to see the
|
|
5038
|
+
// `/` isn't a change from the default currentUrlTree and won't
|
|
5039
|
+
// navigate. This is only applicable with initial navigation, so
|
|
5040
|
+
// setting `navigated` only when not redirecting resolves this
|
|
5041
|
+
// scenario.
|
|
4879
5042
|
this.navigated = true;
|
|
4880
|
-
this.restoreHistory(
|
|
5043
|
+
this.restoreHistory(overallTransitionState, true);
|
|
4881
5044
|
}
|
|
4882
|
-
const navCancel = new NavigationCancel(
|
|
5045
|
+
const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
|
|
4883
5046
|
eventsSubject.next(navCancel);
|
|
4884
5047
|
// When redirecting, we need to delay resolving the navigation
|
|
4885
5048
|
// promise and push it to the redirect navigation
|
|
4886
5049
|
if (!isRedirectingNavigationCancelingError$1(e)) {
|
|
4887
|
-
|
|
5050
|
+
overallTransitionState.resolve(false);
|
|
4888
5051
|
}
|
|
4889
5052
|
else {
|
|
4890
5053
|
const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
|
|
4891
5054
|
const extras = {
|
|
4892
|
-
skipLocationChange:
|
|
5055
|
+
skipLocationChange: overallTransitionState.extras.skipLocationChange,
|
|
4893
5056
|
// The URL is already updated at this point if we have 'eager' URL
|
|
4894
5057
|
// updates or if the navigation was triggered by the browser (back
|
|
4895
|
-
// button, URL bar, etc). We want to replace that item in history
|
|
4896
|
-
// the navigation is rejected.
|
|
5058
|
+
// button, URL bar, etc). We want to replace that item in history
|
|
5059
|
+
// if the navigation is rejected.
|
|
4897
5060
|
replaceUrl: this.urlUpdateStrategy === 'eager' ||
|
|
4898
|
-
isBrowserTriggeredNavigation(
|
|
5061
|
+
isBrowserTriggeredNavigation(overallTransitionState.source)
|
|
4899
5062
|
};
|
|
4900
|
-
this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
|
|
5063
|
+
this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
|
|
5064
|
+
resolve: overallTransitionState.resolve,
|
|
5065
|
+
reject: overallTransitionState.reject,
|
|
5066
|
+
promise: overallTransitionState.promise
|
|
5067
|
+
});
|
|
4901
5068
|
}
|
|
4902
|
-
/* All other errors should reset to the router's internal URL reference
|
|
4903
|
-
* the pre-error state. */
|
|
5069
|
+
/* All other errors should reset to the router's internal URL reference
|
|
5070
|
+
* to the pre-error state. */
|
|
4904
5071
|
}
|
|
4905
5072
|
else {
|
|
4906
|
-
this.restoreHistory(
|
|
4907
|
-
const navError = new NavigationError(
|
|
5073
|
+
this.restoreHistory(overallTransitionState, true);
|
|
5074
|
+
const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
|
|
4908
5075
|
eventsSubject.next(navError);
|
|
4909
5076
|
try {
|
|
4910
|
-
|
|
5077
|
+
overallTransitionState.resolve(this.errorHandler(e));
|
|
4911
5078
|
}
|
|
4912
5079
|
catch (ee) {
|
|
4913
|
-
|
|
5080
|
+
overallTransitionState.reject(ee);
|
|
4914
5081
|
}
|
|
4915
5082
|
}
|
|
4916
5083
|
return EMPTY;
|
|
@@ -5362,10 +5529,14 @@ class Router {
|
|
|
5362
5529
|
return { navigationId };
|
|
5363
5530
|
}
|
|
5364
5531
|
}
|
|
5365
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5366
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
5367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
5368
|
-
type: Injectable
|
|
5532
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5533
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
|
|
5534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: Router, decorators: [{
|
|
5535
|
+
type: Injectable,
|
|
5536
|
+
args: [{
|
|
5537
|
+
providedIn: 'root',
|
|
5538
|
+
useFactory: setupRouter,
|
|
5539
|
+
}]
|
|
5369
5540
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5370
5541
|
function validateCommands(commands) {
|
|
5371
5542
|
for (let i = 0; i < commands.length; i++) {
|
|
@@ -5563,9 +5734,9 @@ class RouterLink {
|
|
|
5563
5734
|
});
|
|
5564
5735
|
}
|
|
5565
5736
|
}
|
|
5566
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5567
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.
|
|
5568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
5737
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5738
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", 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 });
|
|
5739
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLink, decorators: [{
|
|
5569
5740
|
type: Directive,
|
|
5570
5741
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5571
5742
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
@@ -5682,9 +5853,9 @@ class RouterLinkWithHref {
|
|
|
5682
5853
|
});
|
|
5683
5854
|
}
|
|
5684
5855
|
}
|
|
5685
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5686
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.
|
|
5687
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
5856
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5857
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", 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 });
|
|
5858
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5688
5859
|
type: Directive,
|
|
5689
5860
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5690
5861
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5909,9 +6080,9 @@ class RouterLinkActive {
|
|
|
5909
6080
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5910
6081
|
}
|
|
5911
6082
|
}
|
|
5912
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
5913
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.
|
|
5914
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6083
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", 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 });
|
|
6084
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", 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 });
|
|
6085
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5915
6086
|
type: Directive,
|
|
5916
6087
|
args: [{
|
|
5917
6088
|
selector: '[routerLinkActive]',
|
|
@@ -5943,84 +6114,6 @@ function isActiveMatchOptions(options) {
|
|
|
5943
6114
|
return !!options.paths;
|
|
5944
6115
|
}
|
|
5945
6116
|
|
|
5946
|
-
/**
|
|
5947
|
-
* @license
|
|
5948
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5949
|
-
*
|
|
5950
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
5951
|
-
* found in the LICENSE file at https://angular.io/license
|
|
5952
|
-
*/
|
|
5953
|
-
/**
|
|
5954
|
-
* Provides a strategy for setting the page title after a router navigation.
|
|
5955
|
-
*
|
|
5956
|
-
* The built-in implementation traverses the router state snapshot and finds the deepest primary
|
|
5957
|
-
* outlet with `title` property. Given the `Routes` below, navigating to
|
|
5958
|
-
* `/base/child(popup:aux)` would result in the document title being set to "child".
|
|
5959
|
-
* ```
|
|
5960
|
-
* [
|
|
5961
|
-
* {path: 'base', title: 'base', children: [
|
|
5962
|
-
* {path: 'child', title: 'child'},
|
|
5963
|
-
* ],
|
|
5964
|
-
* {path: 'aux', outlet: 'popup', title: 'popupTitle'}
|
|
5965
|
-
* ]
|
|
5966
|
-
* ```
|
|
5967
|
-
*
|
|
5968
|
-
* This class can be used as a base class for custom title strategies. That is, you can create your
|
|
5969
|
-
* own class that extends the `TitleStrategy`. Note that in the above example, the `title`
|
|
5970
|
-
* from the named outlet is never used. However, a custom strategy might be implemented to
|
|
5971
|
-
* incorporate titles in named outlets.
|
|
5972
|
-
*
|
|
5973
|
-
* @publicApi
|
|
5974
|
-
* @see [Page title guide](guide/router#setting-the-page-title)
|
|
5975
|
-
*/
|
|
5976
|
-
class TitleStrategy {
|
|
5977
|
-
/**
|
|
5978
|
-
* @returns The `title` of the deepest primary route.
|
|
5979
|
-
*/
|
|
5980
|
-
buildTitle(snapshot) {
|
|
5981
|
-
let pageTitle;
|
|
5982
|
-
let route = snapshot.root;
|
|
5983
|
-
while (route !== undefined) {
|
|
5984
|
-
pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
|
|
5985
|
-
route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
|
|
5986
|
-
}
|
|
5987
|
-
return pageTitle;
|
|
5988
|
-
}
|
|
5989
|
-
/**
|
|
5990
|
-
* Given an `ActivatedRouteSnapshot`, returns the final value of the
|
|
5991
|
-
* `Route.title` property, which can either be a static string or a resolved value.
|
|
5992
|
-
*/
|
|
5993
|
-
getResolvedTitleForRoute(snapshot) {
|
|
5994
|
-
return snapshot.data[RouteTitle];
|
|
5995
|
-
}
|
|
5996
|
-
}
|
|
5997
|
-
/**
|
|
5998
|
-
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
5999
|
-
*/
|
|
6000
|
-
class DefaultTitleStrategy extends TitleStrategy {
|
|
6001
|
-
constructor(title) {
|
|
6002
|
-
super();
|
|
6003
|
-
this.title = title;
|
|
6004
|
-
}
|
|
6005
|
-
/**
|
|
6006
|
-
* Sets the title of the browser to the given value.
|
|
6007
|
-
*
|
|
6008
|
-
* @param title The `pageTitle` from the deepest primary route.
|
|
6009
|
-
*/
|
|
6010
|
-
updateTitle(snapshot) {
|
|
6011
|
-
const title = this.buildTitle(snapshot);
|
|
6012
|
-
if (title !== undefined) {
|
|
6013
|
-
this.title.setTitle(title);
|
|
6014
|
-
}
|
|
6015
|
-
}
|
|
6016
|
-
}
|
|
6017
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6018
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
6019
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
6020
|
-
type: Injectable,
|
|
6021
|
-
args: [{ providedIn: 'root' }]
|
|
6022
|
-
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
6023
|
-
|
|
6024
6117
|
/**
|
|
6025
6118
|
* @license
|
|
6026
6119
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6053,9 +6146,9 @@ class PreloadAllModules {
|
|
|
6053
6146
|
return fn().pipe(catchError(() => of(null)));
|
|
6054
6147
|
}
|
|
6055
6148
|
}
|
|
6056
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6057
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6058
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6149
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6150
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6059
6152
|
type: Injectable,
|
|
6060
6153
|
args: [{ providedIn: 'root' }]
|
|
6061
6154
|
}] });
|
|
@@ -6073,9 +6166,9 @@ class NoPreloading {
|
|
|
6073
6166
|
return of(null);
|
|
6074
6167
|
}
|
|
6075
6168
|
}
|
|
6076
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6077
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6078
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6169
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6170
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6079
6172
|
type: Injectable,
|
|
6080
6173
|
args: [{ providedIn: 'root' }]
|
|
6081
6174
|
}] });
|
|
@@ -6122,7 +6215,15 @@ class RouterPreloader {
|
|
|
6122
6215
|
}
|
|
6123
6216
|
const injectorForCurrentRoute = route._injector ?? injector;
|
|
6124
6217
|
const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;
|
|
6125
|
-
|
|
6218
|
+
// Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not
|
|
6219
|
+
// `loadComponent`. `canLoad` guards only block loading of child routes by design. This
|
|
6220
|
+
// happens as a consequence of needing to descend into children for route matching immediately
|
|
6221
|
+
// while component loading is deferred until route activation. Because `canLoad` guards can
|
|
6222
|
+
// have side effects, we cannot execute them here so we instead skip preloading altogether
|
|
6223
|
+
// when present. Lastly, it remains to be decided whether `canLoad` should behave this way
|
|
6224
|
+
// at all. Code splitting and lazy loading is separate from client-side authorization checks
|
|
6225
|
+
// and should not be used as a security measure to prevent loading of code.
|
|
6226
|
+
if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||
|
|
6126
6227
|
(route.loadComponent && !route._loadedComponent)) {
|
|
6127
6228
|
res.push(this.preloadConfig(injectorForCurrentRoute, route));
|
|
6128
6229
|
}
|
|
@@ -6161,9 +6262,9 @@ class RouterPreloader {
|
|
|
6161
6262
|
});
|
|
6162
6263
|
}
|
|
6163
6264
|
}
|
|
6164
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6165
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6166
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6265
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6266
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterPreloader });
|
|
6267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6167
6268
|
type: Injectable
|
|
6168
6269
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6169
6270
|
|
|
@@ -6250,9 +6351,9 @@ class RouterScroller {
|
|
|
6250
6351
|
}
|
|
6251
6352
|
}
|
|
6252
6353
|
}
|
|
6253
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6254
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.
|
|
6255
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6354
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6355
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterScroller });
|
|
6356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6256
6357
|
type: Injectable
|
|
6257
6358
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6258
6359
|
|
|
@@ -6268,36 +6369,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
|
6268
6369
|
* The directives defined in the `RouterModule`.
|
|
6269
6370
|
*/
|
|
6270
6371
|
const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent];
|
|
6271
|
-
/**
|
|
6272
|
-
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
6273
|
-
*
|
|
6274
|
-
* @publicApi
|
|
6275
|
-
*/
|
|
6276
|
-
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
|
|
6277
|
-
providedIn: 'root',
|
|
6278
|
-
factory: () => ({}),
|
|
6279
|
-
});
|
|
6280
6372
|
/**
|
|
6281
6373
|
* @docsNotRequired
|
|
6282
6374
|
*/
|
|
6283
6375
|
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6284
6376
|
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6377
|
+
// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
|
|
6378
|
+
// here to avoid a breaking change whereby the provider order matters based on where the
|
|
6379
|
+
// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
|
|
6380
|
+
// change in a major version.
|
|
6285
6381
|
const ROUTER_PROVIDERS = [
|
|
6286
6382
|
Location,
|
|
6287
6383
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
6288
|
-
{
|
|
6289
|
-
provide: Router,
|
|
6290
|
-
useFactory: setupRouter,
|
|
6291
|
-
deps: [
|
|
6292
|
-
UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
|
|
6293
|
-
ROUTER_CONFIGURATION, DefaultTitleStrategy, [TitleStrategy, new Optional()],
|
|
6294
|
-
[UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
|
|
6295
|
-
]
|
|
6296
|
-
},
|
|
6384
|
+
{ provide: Router, useFactory: setupRouter },
|
|
6297
6385
|
ChildrenOutletContexts,
|
|
6298
6386
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6299
6387
|
RouterConfigLoader,
|
|
6300
6388
|
];
|
|
6389
|
+
function rootRoute(router) {
|
|
6390
|
+
return router.routerState.root;
|
|
6391
|
+
}
|
|
6301
6392
|
function routerNgProbeToken() {
|
|
6302
6393
|
return new NgProbeToken('Router', Router);
|
|
6303
6394
|
}
|
|
@@ -6323,8 +6414,7 @@ function routerNgProbeToken() {
|
|
|
6323
6414
|
* @publicApi
|
|
6324
6415
|
*/
|
|
6325
6416
|
class RouterModule {
|
|
6326
|
-
|
|
6327
|
-
constructor(guard, router) { }
|
|
6417
|
+
constructor(guard) { }
|
|
6328
6418
|
/**
|
|
6329
6419
|
* Creates and configures a module with all the router providers and directives.
|
|
6330
6420
|
* Optionally sets up an application listener to perform an initial navigation.
|
|
@@ -6385,10 +6475,10 @@ class RouterModule {
|
|
|
6385
6475
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6386
6476
|
}
|
|
6387
6477
|
}
|
|
6388
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.
|
|
6389
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.
|
|
6390
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.
|
|
6391
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.
|
|
6478
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6479
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6480
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterModule });
|
|
6481
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RouterModule, decorators: [{
|
|
6392
6482
|
type: NgModule,
|
|
6393
6483
|
args: [{
|
|
6394
6484
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6399,8 +6489,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ng
|
|
|
6399
6489
|
}, {
|
|
6400
6490
|
type: Inject,
|
|
6401
6491
|
args: [ROUTER_FORROOT_GUARD]
|
|
6402
|
-
}] }, { type: Router, decorators: [{
|
|
6403
|
-
type: Optional
|
|
6404
6492
|
}] }]; } });
|
|
6405
6493
|
function provideRouterScroller() {
|
|
6406
6494
|
return {
|
|
@@ -6446,48 +6534,9 @@ function provideForRootGuard(router) {
|
|
|
6446
6534
|
*/
|
|
6447
6535
|
function provideRoutes(routes) {
|
|
6448
6536
|
return [
|
|
6449
|
-
{ provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
|
|
6450
6537
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6451
6538
|
];
|
|
6452
6539
|
}
|
|
6453
|
-
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, defaultTitleStrategy, titleStrategy, urlHandlingStrategy, routeReuseStrategy) {
|
|
6454
|
-
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
6455
|
-
if (urlHandlingStrategy) {
|
|
6456
|
-
router.urlHandlingStrategy = urlHandlingStrategy;
|
|
6457
|
-
}
|
|
6458
|
-
if (routeReuseStrategy) {
|
|
6459
|
-
router.routeReuseStrategy = routeReuseStrategy;
|
|
6460
|
-
}
|
|
6461
|
-
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
6462
|
-
assignExtraOptionsToRouter(opts, router);
|
|
6463
|
-
return router;
|
|
6464
|
-
}
|
|
6465
|
-
function assignExtraOptionsToRouter(opts, router) {
|
|
6466
|
-
if (opts.errorHandler) {
|
|
6467
|
-
router.errorHandler = opts.errorHandler;
|
|
6468
|
-
}
|
|
6469
|
-
if (opts.malformedUriErrorHandler) {
|
|
6470
|
-
router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
|
|
6471
|
-
}
|
|
6472
|
-
if (opts.onSameUrlNavigation) {
|
|
6473
|
-
router.onSameUrlNavigation = opts.onSameUrlNavigation;
|
|
6474
|
-
}
|
|
6475
|
-
if (opts.paramsInheritanceStrategy) {
|
|
6476
|
-
router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
|
6477
|
-
}
|
|
6478
|
-
if (opts.relativeLinkResolution) {
|
|
6479
|
-
router.relativeLinkResolution = opts.relativeLinkResolution;
|
|
6480
|
-
}
|
|
6481
|
-
if (opts.urlUpdateStrategy) {
|
|
6482
|
-
router.urlUpdateStrategy = opts.urlUpdateStrategy;
|
|
6483
|
-
}
|
|
6484
|
-
if (opts.canceledNavigationResolution) {
|
|
6485
|
-
router.canceledNavigationResolution = opts.canceledNavigationResolution;
|
|
6486
|
-
}
|
|
6487
|
-
}
|
|
6488
|
-
function rootRoute(router) {
|
|
6489
|
-
return router.routerState.root;
|
|
6490
|
-
}
|
|
6491
6540
|
function getBootstrapListener() {
|
|
6492
6541
|
const injector = inject(Injector);
|
|
6493
6542
|
return (bootstrappedComponentRef) => {
|
|
@@ -6497,8 +6546,7 @@ function getBootstrapListener() {
|
|
|
6497
6546
|
}
|
|
6498
6547
|
const router = injector.get(Router);
|
|
6499
6548
|
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6500
|
-
|
|
6501
|
-
if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
|
|
6549
|
+
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6502
6550
|
router.initialNavigation();
|
|
6503
6551
|
}
|
|
6504
6552
|
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
@@ -6542,7 +6590,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
|
|
|
6542
6590
|
});
|
|
6543
6591
|
function provideEnabledBlockingInitialNavigation() {
|
|
6544
6592
|
return [
|
|
6545
|
-
{ provide: INITIAL_NAVIGATION, useValue:
|
|
6593
|
+
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6546
6594
|
{
|
|
6547
6595
|
provide: APP_INITIALIZER,
|
|
6548
6596
|
multi: true,
|
|
@@ -6608,7 +6656,7 @@ function provideEnabledBlockingInitialNavigation() {
|
|
|
6608
6656
|
},
|
|
6609
6657
|
];
|
|
6610
6658
|
}
|
|
6611
|
-
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
|
|
6659
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6612
6660
|
function provideDisabledInitialNavigation() {
|
|
6613
6661
|
return [
|
|
6614
6662
|
{
|
|
@@ -6621,7 +6669,7 @@ function provideDisabledInitialNavigation() {
|
|
|
6621
6669
|
};
|
|
6622
6670
|
}
|
|
6623
6671
|
},
|
|
6624
|
-
{ provide: INITIAL_NAVIGATION, useValue:
|
|
6672
|
+
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6625
6673
|
];
|
|
6626
6674
|
}
|
|
6627
6675
|
function provideTracing() {
|
|
@@ -6664,7 +6712,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6664
6712
|
/**
|
|
6665
6713
|
* @publicApi
|
|
6666
6714
|
*/
|
|
6667
|
-
const VERSION = new Version('14.1.
|
|
6715
|
+
const VERSION = new Version('14.1.2');
|
|
6668
6716
|
|
|
6669
6717
|
/**
|
|
6670
6718
|
* @license
|