@angular/router 14.1.3 → 14.2.0-rc.0
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 +10 -6
- package/esm2020/src/directives/router_link.mjs +106 -25
- package/esm2020/src/directives/router_link_active.mjs +5 -4
- package/esm2020/src/directives/router_outlet.mjs +9 -5
- package/esm2020/src/index.mjs +4 -3
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/operators/check_guards.mjs +36 -26
- package/esm2020/src/operators/resolve_data.mjs +19 -21
- package/esm2020/src/page_title_strategy.mjs +9 -10
- package/esm2020/src/private_export.mjs +3 -2
- package/esm2020/src/provide_router.mjs +420 -0
- package/esm2020/src/router.mjs +3 -3
- package/esm2020/src/router_config.mjs +1 -1
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +27 -185
- package/esm2020/src/router_outlet_context.mjs +3 -3
- package/esm2020/src/router_preloader.mjs +12 -11
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/router_state.mjs +7 -3
- package/esm2020/src/shared.mjs +22 -2
- package/esm2020/src/url_tree.mjs +3 -3
- package/esm2020/src/utils/preactivation.mjs +16 -6
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/provide_router_for_testing.mjs +51 -0
- package/esm2020/testing/src/router_testing_module.mjs +8 -8
- package/fesm2015/router.mjs +722 -332
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +8 -8
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +714 -330
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +8 -8
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +614 -215
- 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,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.
|
|
2
|
+
* @license Angular v14.2.0-rc.0
|
|
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, 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,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, APP_BOOTSTRAP_LISTENER, ApplicationRef, APP_INITIALIZER, ENVIRONMENT_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
|
|
9
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, ViewportScroller, LocationStrategy, HashLocationStrategy, PathLocationStrategy
|
|
11
|
+
import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
|
|
12
12
|
import { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
|
|
13
13
|
import * as i1 from '@angular/platform-browser';
|
|
14
14
|
|
|
@@ -25,6 +25,12 @@ import * as i1 from '@angular/platform-browser';
|
|
|
25
25
|
* @publicApi
|
|
26
26
|
*/
|
|
27
27
|
const PRIMARY_OUTLET = 'primary';
|
|
28
|
+
/**
|
|
29
|
+
* A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
|
|
30
|
+
* static string or `Route.resolve` if anything else. This allows us to reuse the existing route
|
|
31
|
+
* data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
|
|
32
|
+
*/
|
|
33
|
+
const RouteTitleKey = Symbol('RouteTitle');
|
|
28
34
|
class ParamsAsMap {
|
|
29
35
|
constructor(params) {
|
|
30
36
|
this.params = params || {};
|
|
@@ -60,7 +66,21 @@ class ParamsAsMap {
|
|
|
60
66
|
function convertToParamMap(params) {
|
|
61
67
|
return new ParamsAsMap(params);
|
|
62
68
|
}
|
|
63
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Matches the route configuration (`route`) against the actual URL (`segments`).
|
|
71
|
+
*
|
|
72
|
+
* When no matcher is defined on a `Route`, this is the matcher used by the Router by default.
|
|
73
|
+
*
|
|
74
|
+
* @param segments The remaining unmatched segments in the current navigation
|
|
75
|
+
* @param segmentGroup The current segment group being matched
|
|
76
|
+
* @param route The `Route` to match against.
|
|
77
|
+
*
|
|
78
|
+
* @see UrlMatchResult
|
|
79
|
+
* @see Route
|
|
80
|
+
*
|
|
81
|
+
* @returns The resulting match information or `null` if the `route` should not match.
|
|
82
|
+
* @publicApi
|
|
83
|
+
*/
|
|
64
84
|
function defaultUrlMatcher(segments, segmentGroup, route) {
|
|
65
85
|
const parts = route.path.split('/');
|
|
66
86
|
if (parts.length > segments.length) {
|
|
@@ -182,7 +202,7 @@ function wrapIntoObservable(value) {
|
|
|
182
202
|
* Use of this source code is governed by an MIT-style license that can be
|
|
183
203
|
* found in the LICENSE file at https://angular.io/license
|
|
184
204
|
*/
|
|
185
|
-
const NG_DEV_MODE$
|
|
205
|
+
const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
186
206
|
function createEmptyUrlTree() {
|
|
187
207
|
return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
|
|
188
208
|
}
|
|
@@ -439,9 +459,9 @@ function mapChildrenIntoArray(segment, fn) {
|
|
|
439
459
|
*/
|
|
440
460
|
class UrlSerializer {
|
|
441
461
|
}
|
|
442
|
-
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
443
|
-
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
444
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
462
|
+
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
463
|
+
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
|
|
464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: UrlSerializer, decorators: [{
|
|
445
465
|
type: Injectable,
|
|
446
466
|
args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
|
|
447
467
|
}] });
|
|
@@ -653,7 +673,7 @@ class UrlParser {
|
|
|
653
673
|
parseSegment() {
|
|
654
674
|
const path = matchSegments(this.remaining);
|
|
655
675
|
if (path === '' && this.peekStartsWith(';')) {
|
|
656
|
-
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$
|
|
676
|
+
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$9 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
|
|
657
677
|
}
|
|
658
678
|
this.capture(path);
|
|
659
679
|
return new UrlSegment(decode(path), this.parseMatrixParams());
|
|
@@ -722,7 +742,7 @@ class UrlParser {
|
|
|
722
742
|
// if is is not one of these characters, then the segment was unescaped
|
|
723
743
|
// or the group was not closed
|
|
724
744
|
if (next !== '/' && next !== ')' && next !== ';') {
|
|
725
|
-
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$
|
|
745
|
+
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$9 && `Cannot parse url '${this.url}'`);
|
|
726
746
|
}
|
|
727
747
|
let outletName = undefined;
|
|
728
748
|
if (path.indexOf(':') > -1) {
|
|
@@ -753,7 +773,7 @@ class UrlParser {
|
|
|
753
773
|
}
|
|
754
774
|
capture(str) {
|
|
755
775
|
if (!this.consumeOptional(str)) {
|
|
756
|
-
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$
|
|
776
|
+
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$9 && `Expected "${str}".`);
|
|
757
777
|
}
|
|
758
778
|
}
|
|
759
779
|
}
|
|
@@ -806,7 +826,7 @@ function isUrlTree(v) {
|
|
|
806
826
|
* Use of this source code is governed by an MIT-style license that can be
|
|
807
827
|
* found in the LICENSE file at https://angular.io/license
|
|
808
828
|
*/
|
|
809
|
-
const NG_DEV_MODE$
|
|
829
|
+
const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
810
830
|
/**
|
|
811
831
|
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
812
832
|
*
|
|
@@ -982,11 +1002,11 @@ class Navigation {
|
|
|
982
1002
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
983
1003
|
this.commands = commands;
|
|
984
1004
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
985
|
-
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$
|
|
1005
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
|
|
986
1006
|
}
|
|
987
1007
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
988
1008
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
989
|
-
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$
|
|
1009
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
|
|
990
1010
|
}
|
|
991
1011
|
}
|
|
992
1012
|
toRoot() {
|
|
@@ -1085,7 +1105,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1085
1105
|
dd -= ci;
|
|
1086
1106
|
g = g.parent;
|
|
1087
1107
|
if (!g) {
|
|
1088
|
-
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$
|
|
1108
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
|
|
1089
1109
|
}
|
|
1090
1110
|
ci = g.segments.length;
|
|
1091
1111
|
}
|
|
@@ -1915,6 +1935,8 @@ class ActivatedRoute {
|
|
|
1915
1935
|
this.data = data;
|
|
1916
1936
|
this.outlet = outlet;
|
|
1917
1937
|
this.component = component;
|
|
1938
|
+
/** An Observable of the resolved route title */
|
|
1939
|
+
this.title = this.data?.pipe(map((d) => d[RouteTitleKey])) ?? of(undefined);
|
|
1918
1940
|
this._futureSnapshot = futureSnapshot;
|
|
1919
1941
|
}
|
|
1920
1942
|
/** The configuration used to match this route. */
|
|
@@ -2069,6 +2091,8 @@ class ActivatedRouteSnapshot {
|
|
|
2069
2091
|
this.data = data;
|
|
2070
2092
|
this.outlet = outlet;
|
|
2071
2093
|
this.component = component;
|
|
2094
|
+
/** The resolved route title */
|
|
2095
|
+
this.title = this.data?.[RouteTitleKey];
|
|
2072
2096
|
this.routeConfig = routeConfig;
|
|
2073
2097
|
this._urlSegment = urlSegment;
|
|
2074
2098
|
this._lastPathIndex = lastPathIndex;
|
|
@@ -2358,9 +2382,9 @@ class ChildrenOutletContexts {
|
|
|
2358
2382
|
return this.contexts.get(childName) || null;
|
|
2359
2383
|
}
|
|
2360
2384
|
}
|
|
2361
|
-
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
2362
|
-
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
2363
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
2385
|
+
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2386
|
+
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
|
|
2387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
2364
2388
|
type: Injectable,
|
|
2365
2389
|
args: [{ providedIn: 'root' }]
|
|
2366
2390
|
}] });
|
|
@@ -2372,7 +2396,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2372
2396
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2373
2397
|
* found in the LICENSE file at https://angular.io/license
|
|
2374
2398
|
*/
|
|
2375
|
-
const NG_DEV_MODE$
|
|
2399
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2376
2400
|
/**
|
|
2377
2401
|
* @description
|
|
2378
2402
|
*
|
|
@@ -2481,12 +2505,12 @@ class RouterOutlet {
|
|
|
2481
2505
|
*/
|
|
2482
2506
|
get component() {
|
|
2483
2507
|
if (!this.activated)
|
|
2484
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2508
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2485
2509
|
return this.activated.instance;
|
|
2486
2510
|
}
|
|
2487
2511
|
get activatedRoute() {
|
|
2488
2512
|
if (!this.activated)
|
|
2489
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2513
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2490
2514
|
return this._activatedRoute;
|
|
2491
2515
|
}
|
|
2492
2516
|
get activatedRouteData() {
|
|
@@ -2500,7 +2524,7 @@ class RouterOutlet {
|
|
|
2500
2524
|
*/
|
|
2501
2525
|
detach() {
|
|
2502
2526
|
if (!this.activated)
|
|
2503
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2527
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2504
2528
|
this.location.detach();
|
|
2505
2529
|
const cmp = this.activated;
|
|
2506
2530
|
this.activated = null;
|
|
@@ -2528,7 +2552,7 @@ class RouterOutlet {
|
|
|
2528
2552
|
}
|
|
2529
2553
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2530
2554
|
if (this.isActivated) {
|
|
2531
|
-
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$
|
|
2555
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
|
|
2532
2556
|
}
|
|
2533
2557
|
this._activatedRoute = activatedRoute;
|
|
2534
2558
|
const location = this.location;
|
|
@@ -2550,11 +2574,15 @@ class RouterOutlet {
|
|
|
2550
2574
|
this.activateEvents.emit(this.activated.instance);
|
|
2551
2575
|
}
|
|
2552
2576
|
}
|
|
2553
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
2554
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
2555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
2577
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2578
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-rc.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2556
2580
|
type: Directive,
|
|
2557
|
-
args: [{
|
|
2581
|
+
args: [{
|
|
2582
|
+
selector: 'router-outlet',
|
|
2583
|
+
exportAs: 'outlet',
|
|
2584
|
+
standalone: true,
|
|
2585
|
+
}]
|
|
2558
2586
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
2559
2587
|
type: Attribute,
|
|
2560
2588
|
args: ['name']
|
|
@@ -2609,11 +2637,15 @@ function isComponentFactoryResolver(item) {
|
|
|
2609
2637
|
*/
|
|
2610
2638
|
class ɵEmptyOutletComponent {
|
|
2611
2639
|
}
|
|
2612
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
2613
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.
|
|
2614
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
2640
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2641
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0-rc.0", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2642
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2615
2643
|
type: Component,
|
|
2616
|
-
args: [{
|
|
2644
|
+
args: [{
|
|
2645
|
+
template: `<router-outlet></router-outlet>`,
|
|
2646
|
+
imports: [RouterOutlet],
|
|
2647
|
+
standalone: true,
|
|
2648
|
+
}]
|
|
2617
2649
|
}] });
|
|
2618
2650
|
|
|
2619
2651
|
/**
|
|
@@ -3011,10 +3043,20 @@ function getCanActivateChild(p) {
|
|
|
3011
3043
|
return null;
|
|
3012
3044
|
return { node: p, guards: canActivateChild };
|
|
3013
3045
|
}
|
|
3014
|
-
function
|
|
3015
|
-
const
|
|
3016
|
-
const
|
|
3017
|
-
|
|
3046
|
+
function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
|
|
3047
|
+
const NOT_FOUND = Symbol();
|
|
3048
|
+
const result = injector.get(tokenOrFunction, NOT_FOUND);
|
|
3049
|
+
if (result === NOT_FOUND) {
|
|
3050
|
+
if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {
|
|
3051
|
+
// We think the token is just a function so return it as-is
|
|
3052
|
+
return tokenOrFunction;
|
|
3053
|
+
}
|
|
3054
|
+
else {
|
|
3055
|
+
// This will throw the not found error
|
|
3056
|
+
return injector.get(tokenOrFunction);
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
return result;
|
|
3018
3060
|
}
|
|
3019
3061
|
function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
|
|
3020
3062
|
canDeactivateChecks: [],
|
|
@@ -3213,28 +3255,28 @@ function prioritizedGuardValue() {
|
|
|
3213
3255
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3214
3256
|
* found in the LICENSE file at https://angular.io/license
|
|
3215
3257
|
*/
|
|
3216
|
-
function checkGuards(
|
|
3258
|
+
function checkGuards(injector, forwardEvent) {
|
|
3217
3259
|
return mergeMap(t => {
|
|
3218
3260
|
const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
|
|
3219
3261
|
if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
|
|
3220
3262
|
return of({ ...t, guardsResult: true });
|
|
3221
3263
|
}
|
|
3222
|
-
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot,
|
|
3264
|
+
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector)
|
|
3223
3265
|
.pipe(mergeMap(canDeactivate => {
|
|
3224
3266
|
return canDeactivate && isBoolean(canDeactivate) ?
|
|
3225
|
-
runCanActivateChecks(targetSnapshot, canActivateChecks,
|
|
3267
|
+
runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) :
|
|
3226
3268
|
of(canDeactivate);
|
|
3227
3269
|
}), map(guardsResult => ({ ...t, guardsResult })));
|
|
3228
3270
|
});
|
|
3229
3271
|
}
|
|
3230
|
-
function runCanDeactivateChecks(checks, futureRSS, currRSS,
|
|
3231
|
-
return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS,
|
|
3272
|
+
function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
|
|
3273
|
+
return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {
|
|
3232
3274
|
return result !== true;
|
|
3233
3275
|
}, true));
|
|
3234
3276
|
}
|
|
3235
|
-
function runCanActivateChecks(futureSnapshot, checks,
|
|
3277
|
+
function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
|
|
3236
3278
|
return from(checks).pipe(concatMap((check) => {
|
|
3237
|
-
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path,
|
|
3279
|
+
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
|
|
3238
3280
|
}), first(result => {
|
|
3239
3281
|
return result !== true;
|
|
3240
3282
|
}, true));
|
|
@@ -3267,21 +3309,23 @@ function fireChildActivationStart(snapshot, forwardEvent) {
|
|
|
3267
3309
|
}
|
|
3268
3310
|
return of(true);
|
|
3269
3311
|
}
|
|
3270
|
-
function runCanActivate(futureRSS, futureARS,
|
|
3312
|
+
function runCanActivate(futureRSS, futureARS, injector) {
|
|
3271
3313
|
const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
|
|
3272
3314
|
if (!canActivate || canActivate.length === 0)
|
|
3273
3315
|
return of(true);
|
|
3274
|
-
const canActivateObservables = canActivate.map((
|
|
3316
|
+
const canActivateObservables = canActivate.map((canActivate) => {
|
|
3275
3317
|
return defer(() => {
|
|
3276
|
-
const
|
|
3277
|
-
const
|
|
3278
|
-
|
|
3318
|
+
const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
|
|
3319
|
+
const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
|
|
3320
|
+
const guardVal = isCanActivate(guard) ?
|
|
3321
|
+
guard.canActivate(futureARS, futureRSS) :
|
|
3322
|
+
closestInjector.runInContext(() => guard(futureARS, futureRSS));
|
|
3279
3323
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3280
3324
|
});
|
|
3281
3325
|
});
|
|
3282
3326
|
return of(canActivateObservables).pipe(prioritizedGuardValue());
|
|
3283
3327
|
}
|
|
3284
|
-
function runCanActivateChild(futureRSS, path,
|
|
3328
|
+
function runCanActivateChild(futureRSS, path, injector) {
|
|
3285
3329
|
const futureARS = path[path.length - 1];
|
|
3286
3330
|
const canActivateChildGuards = path.slice(0, path.length - 1)
|
|
3287
3331
|
.reverse()
|
|
@@ -3289,10 +3333,12 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3289
3333
|
.filter(_ => _ !== null);
|
|
3290
3334
|
const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
|
|
3291
3335
|
return defer(() => {
|
|
3292
|
-
const guardsMapped = d.guards.map((
|
|
3293
|
-
const
|
|
3294
|
-
const
|
|
3295
|
-
|
|
3336
|
+
const guardsMapped = d.guards.map((canActivateChild) => {
|
|
3337
|
+
const closestInjector = getClosestRouteInjector(d.node) ?? injector;
|
|
3338
|
+
const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
|
|
3339
|
+
const guardVal = isCanActivateChild(guard) ?
|
|
3340
|
+
guard.canActivateChild(futureARS, futureRSS) :
|
|
3341
|
+
closestInjector.runInContext(() => guard(futureARS, futureRSS));
|
|
3296
3342
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3297
3343
|
});
|
|
3298
3344
|
return of(guardsMapped).pipe(prioritizedGuardValue());
|
|
@@ -3300,15 +3346,16 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3300
3346
|
});
|
|
3301
3347
|
return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
|
|
3302
3348
|
}
|
|
3303
|
-
function runCanDeactivate(component, currARS, currRSS, futureRSS,
|
|
3349
|
+
function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
|
|
3304
3350
|
const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
|
|
3305
3351
|
if (!canDeactivate || canDeactivate.length === 0)
|
|
3306
3352
|
return of(true);
|
|
3307
3353
|
const canDeactivateObservables = canDeactivate.map((c) => {
|
|
3308
|
-
const
|
|
3354
|
+
const closestInjector = getClosestRouteInjector(currARS) ?? injector;
|
|
3355
|
+
const guard = getTokenOrFunctionIdentity(c, closestInjector);
|
|
3309
3356
|
const guardVal = isCanDeactivate(guard) ?
|
|
3310
3357
|
guard.canDeactivate(component, currARS, currRSS, futureRSS) :
|
|
3311
|
-
guard(component, currARS, currRSS, futureRSS);
|
|
3358
|
+
closestInjector.runInContext(() => guard(component, currARS, currRSS, futureRSS));
|
|
3312
3359
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3313
3360
|
});
|
|
3314
3361
|
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
|
@@ -3319,8 +3366,10 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
|
|
|
3319
3366
|
return of(true);
|
|
3320
3367
|
}
|
|
3321
3368
|
const canLoadObservables = canLoad.map((injectionToken) => {
|
|
3322
|
-
const guard =
|
|
3323
|
-
const guardVal = isCanLoad(guard) ?
|
|
3369
|
+
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
|
|
3370
|
+
const guardVal = isCanLoad(guard) ?
|
|
3371
|
+
guard.canLoad(route, segments) :
|
|
3372
|
+
injector.runInContext(() => guard(route, segments));
|
|
3324
3373
|
return wrapIntoObservable(guardVal);
|
|
3325
3374
|
});
|
|
3326
3375
|
return of(canLoadObservables)
|
|
@@ -3338,8 +3387,10 @@ function runCanMatchGuards(injector, route, segments, urlSerializer) {
|
|
|
3338
3387
|
if (!canMatch || canMatch.length === 0)
|
|
3339
3388
|
return of(true);
|
|
3340
3389
|
const canMatchObservables = canMatch.map(injectionToken => {
|
|
3341
|
-
const guard =
|
|
3342
|
-
const guardVal = isCanMatch(guard) ?
|
|
3390
|
+
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
|
|
3391
|
+
const guardVal = isCanMatch(guard) ?
|
|
3392
|
+
guard.canMatch(route, segments) :
|
|
3393
|
+
injector.runInContext(() => guard(route, segments));
|
|
3343
3394
|
return wrapIntoObservable(guardVal);
|
|
3344
3395
|
});
|
|
3345
3396
|
return of(canMatchObservables)
|
|
@@ -3508,7 +3559,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3508
3559
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3509
3560
|
* found in the LICENSE file at https://angular.io/license
|
|
3510
3561
|
*/
|
|
3511
|
-
const NG_DEV_MODE$
|
|
3562
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3512
3563
|
class NoMatch$1 {
|
|
3513
3564
|
constructor(segmentGroup) {
|
|
3514
3565
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3526,11 +3577,11 @@ function absoluteRedirect(newTree) {
|
|
|
3526
3577
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3527
3578
|
}
|
|
3528
3579
|
function namedOutletsRedirect(redirectTo) {
|
|
3529
|
-
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$
|
|
3580
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3530
3581
|
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3531
3582
|
}
|
|
3532
3583
|
function canLoadFails(route) {
|
|
3533
|
-
return throwError(navigationCancelingError(NG_DEV_MODE$
|
|
3584
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
|
|
3534
3585
|
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3535
3586
|
}
|
|
3536
3587
|
/**
|
|
@@ -3590,7 +3641,7 @@ class ApplyRedirects {
|
|
|
3590
3641
|
}));
|
|
3591
3642
|
}
|
|
3592
3643
|
noMatchError(e) {
|
|
3593
|
-
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$
|
|
3644
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3594
3645
|
}
|
|
3595
3646
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3596
3647
|
const root = createRoot(rootCandidate);
|
|
@@ -3805,7 +3856,7 @@ class ApplyRedirects {
|
|
|
3805
3856
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3806
3857
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3807
3858
|
if (!pos)
|
|
3808
|
-
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$
|
|
3859
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3809
3860
|
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3810
3861
|
return pos;
|
|
3811
3862
|
}
|
|
@@ -3841,7 +3892,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
|
|
|
3841
3892
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3842
3893
|
* found in the LICENSE file at https://angular.io/license
|
|
3843
3894
|
*/
|
|
3844
|
-
const NG_DEV_MODE$
|
|
3895
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3845
3896
|
class NoMatch {
|
|
3846
3897
|
}
|
|
3847
3898
|
function newObservableError(e) {
|
|
@@ -3930,7 +3981,7 @@ class Recognizer {
|
|
|
3930
3981
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3931
3982
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3932
3983
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3933
|
-
if (NG_DEV_MODE$
|
|
3984
|
+
if (NG_DEV_MODE$5) {
|
|
3934
3985
|
// This should really never happen - we are only taking the first match for each
|
|
3935
3986
|
// outlet and merge the empty path matches.
|
|
3936
3987
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -3963,7 +4014,7 @@ class Recognizer {
|
|
|
3963
4014
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3964
4015
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3965
4016
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3966
|
-
(NG_DEV_MODE$
|
|
4017
|
+
(NG_DEV_MODE$5 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3967
4018
|
pathIndexShift));
|
|
3968
4019
|
matchResult = of({
|
|
3969
4020
|
snapshot,
|
|
@@ -3979,7 +4030,7 @@ class Recognizer {
|
|
|
3979
4030
|
return null;
|
|
3980
4031
|
}
|
|
3981
4032
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
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$
|
|
4033
|
+
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$5 ?
|
|
3983
4034
|
getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3984
4035
|
pathIndexShift));
|
|
3985
4036
|
return { snapshot, consumedSegments, remainingSegments };
|
|
@@ -4092,7 +4143,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4092
4143
|
if (routeWithSameOutletName) {
|
|
4093
4144
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4094
4145
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4095
|
-
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$
|
|
4146
|
+
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$5 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
|
|
4096
4147
|
}
|
|
4097
4148
|
names[n.value.outlet] = n.value;
|
|
4098
4149
|
});
|
|
@@ -4148,13 +4199,7 @@ function recognize(injector, rootComponentType, config, serializer, paramsInheri
|
|
|
4148
4199
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4149
4200
|
* found in the LICENSE file at https://angular.io/license
|
|
4150
4201
|
*/
|
|
4151
|
-
|
|
4152
|
-
* A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
|
|
4153
|
-
* static string or `Route.resolve` if anything else. This allows us to reuse the existing route
|
|
4154
|
-
* data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
|
|
4155
|
-
*/
|
|
4156
|
-
const RouteTitle = Symbol('RouteTitle');
|
|
4157
|
-
function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
4202
|
+
function resolveData(paramsInheritanceStrategy, injector) {
|
|
4158
4203
|
return mergeMap(t => {
|
|
4159
4204
|
const { targetSnapshot, guards: { canActivateChecks } } = t;
|
|
4160
4205
|
if (!canActivateChecks.length) {
|
|
@@ -4162,32 +4207,31 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
|
4162
4207
|
}
|
|
4163
4208
|
let canActivateChecksResolved = 0;
|
|
4164
4209
|
return from(canActivateChecks)
|
|
4165
|
-
.pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy,
|
|
4210
|
+
.pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, injector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
|
|
4166
4211
|
});
|
|
4167
4212
|
}
|
|
4168
|
-
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy,
|
|
4213
|
+
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
|
|
4169
4214
|
const config = futureARS.routeConfig;
|
|
4170
4215
|
const resolve = futureARS._resolve;
|
|
4171
4216
|
if (config?.title !== undefined && !hasStaticTitle(config)) {
|
|
4172
|
-
resolve[
|
|
4217
|
+
resolve[RouteTitleKey] = config.title;
|
|
4173
4218
|
}
|
|
4174
|
-
return resolveNode(resolve, futureARS, futureRSS,
|
|
4175
|
-
.pipe(map((resolvedData) => {
|
|
4219
|
+
return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => {
|
|
4176
4220
|
futureARS._resolvedData = resolvedData;
|
|
4177
4221
|
futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve;
|
|
4178
4222
|
if (config && hasStaticTitle(config)) {
|
|
4179
|
-
futureARS.data[
|
|
4223
|
+
futureARS.data[RouteTitleKey] = config.title;
|
|
4180
4224
|
}
|
|
4181
4225
|
return null;
|
|
4182
4226
|
}));
|
|
4183
4227
|
}
|
|
4184
|
-
function resolveNode(resolve, futureARS, futureRSS,
|
|
4228
|
+
function resolveNode(resolve, futureARS, futureRSS, injector) {
|
|
4185
4229
|
const keys = getDataKeys(resolve);
|
|
4186
4230
|
if (keys.length === 0) {
|
|
4187
4231
|
return of({});
|
|
4188
4232
|
}
|
|
4189
4233
|
const data = {};
|
|
4190
|
-
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS,
|
|
4234
|
+
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector)
|
|
4191
4235
|
.pipe(first(), tap((value) => {
|
|
4192
4236
|
data[key] = value;
|
|
4193
4237
|
}))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
|
|
@@ -4195,10 +4239,13 @@ function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
|
|
|
4195
4239
|
function getDataKeys(obj) {
|
|
4196
4240
|
return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
|
|
4197
4241
|
}
|
|
4198
|
-
function getResolver(injectionToken, futureARS, futureRSS,
|
|
4199
|
-
const
|
|
4200
|
-
|
|
4201
|
-
|
|
4242
|
+
function getResolver(injectionToken, futureARS, futureRSS, injector) {
|
|
4243
|
+
const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
|
|
4244
|
+
const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
|
|
4245
|
+
const resolverValue = resolver.resolve ?
|
|
4246
|
+
resolver.resolve(futureARS, futureRSS) :
|
|
4247
|
+
closestInjector.runInContext(() => resolver(futureARS, futureRSS));
|
|
4248
|
+
return wrapIntoObservable(resolverValue);
|
|
4202
4249
|
}
|
|
4203
4250
|
function hasStaticTitle(config) {
|
|
4204
4251
|
return typeof config.title === 'string' || config.title === null;
|
|
@@ -4275,12 +4322,12 @@ class TitleStrategy {
|
|
|
4275
4322
|
* `Route.title` property, which can either be a static string or a resolved value.
|
|
4276
4323
|
*/
|
|
4277
4324
|
getResolvedTitleForRoute(snapshot) {
|
|
4278
|
-
return snapshot.data[
|
|
4325
|
+
return snapshot.data[RouteTitleKey];
|
|
4279
4326
|
}
|
|
4280
4327
|
}
|
|
4281
|
-
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
4282
|
-
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
4283
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
4328
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4329
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4284
4331
|
type: Injectable,
|
|
4285
4332
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4286
4333
|
}] });
|
|
@@ -4304,9 +4351,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
4304
4351
|
}
|
|
4305
4352
|
}
|
|
4306
4353
|
}
|
|
4307
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
4308
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
4309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
4354
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4355
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4310
4357
|
type: Injectable,
|
|
4311
4358
|
args: [{ providedIn: 'root' }]
|
|
4312
4359
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -4395,13 +4442,13 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4395
4442
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4396
4443
|
* found in the LICENSE file at https://angular.io/license
|
|
4397
4444
|
*/
|
|
4398
|
-
const NG_DEV_MODE$
|
|
4445
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4399
4446
|
/**
|
|
4400
4447
|
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
4401
4448
|
*
|
|
4402
4449
|
* @publicApi
|
|
4403
4450
|
*/
|
|
4404
|
-
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$
|
|
4451
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
|
|
4405
4452
|
providedIn: 'root',
|
|
4406
4453
|
factory: () => ({}),
|
|
4407
4454
|
});
|
|
@@ -4413,7 +4460,7 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config'
|
|
|
4413
4460
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4414
4461
|
* found in the LICENSE file at https://angular.io/license
|
|
4415
4462
|
*/
|
|
4416
|
-
const NG_DEV_MODE$
|
|
4463
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4417
4464
|
/**
|
|
4418
4465
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4419
4466
|
*
|
|
@@ -4447,7 +4494,7 @@ class RouterConfigLoader {
|
|
|
4447
4494
|
if (this.onLoadEndListener) {
|
|
4448
4495
|
this.onLoadEndListener(route);
|
|
4449
4496
|
}
|
|
4450
|
-
NG_DEV_MODE$
|
|
4497
|
+
NG_DEV_MODE$3 && assertStandalone(route.path ?? '', component);
|
|
4451
4498
|
route._loadedComponent = component;
|
|
4452
4499
|
}), finalize(() => {
|
|
4453
4500
|
this.componentLoaders.delete(route);
|
|
@@ -4490,7 +4537,7 @@ class RouterConfigLoader {
|
|
|
4490
4537
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4491
4538
|
}
|
|
4492
4539
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4493
|
-
NG_DEV_MODE$
|
|
4540
|
+
NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4494
4541
|
return { routes, injector };
|
|
4495
4542
|
}), finalize(() => {
|
|
4496
4543
|
this.childrenLoaders.delete(route);
|
|
@@ -4512,9 +4559,9 @@ class RouterConfigLoader {
|
|
|
4512
4559
|
}));
|
|
4513
4560
|
}
|
|
4514
4561
|
}
|
|
4515
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
4516
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
4517
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
4562
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4563
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4564
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4518
4565
|
type: Injectable,
|
|
4519
4566
|
args: [{ providedIn: 'root' }]
|
|
4520
4567
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
@@ -4557,7 +4604,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4557
4604
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4558
4605
|
* found in the LICENSE file at https://angular.io/license
|
|
4559
4606
|
*/
|
|
4560
|
-
const NG_DEV_MODE$
|
|
4607
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4561
4608
|
function defaultErrorHandler(error) {
|
|
4562
4609
|
throw error;
|
|
4563
4610
|
}
|
|
@@ -4962,7 +5009,7 @@ class Router {
|
|
|
4962
5009
|
complete: () => {
|
|
4963
5010
|
if (!dataResolved) {
|
|
4964
5011
|
this.restoreHistory(t);
|
|
4965
|
-
this.cancelNavigationTransition(t, NG_DEV_MODE$
|
|
5012
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
|
|
4966
5013
|
`At least one route resolver didn't emit any value.` :
|
|
4967
5014
|
'', 2 /* NavigationCancellationCode.NoDataFromResolver */);
|
|
4968
5015
|
}
|
|
@@ -5029,7 +5076,7 @@ class Router {
|
|
|
5029
5076
|
* catch-all to make sure the NavigationCancel event is fired when a
|
|
5030
5077
|
* navigation gets cancelled but not caught by other means. */
|
|
5031
5078
|
if (!completed && !errored) {
|
|
5032
|
-
const cancelationReason = NG_DEV_MODE$
|
|
5079
|
+
const cancelationReason = NG_DEV_MODE$2 ?
|
|
5033
5080
|
`Navigation ID ${overallTransitionState
|
|
5034
5081
|
.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
5035
5082
|
'';
|
|
@@ -5187,7 +5234,7 @@ class Router {
|
|
|
5187
5234
|
* ```
|
|
5188
5235
|
*/
|
|
5189
5236
|
resetConfig(config) {
|
|
5190
|
-
NG_DEV_MODE$
|
|
5237
|
+
NG_DEV_MODE$2 && validateConfig(config);
|
|
5191
5238
|
this.config = config.map(standardizeConfig);
|
|
5192
5239
|
this.navigated = false;
|
|
5193
5240
|
this.lastSuccessfulId = -1;
|
|
@@ -5542,9 +5589,9 @@ class Router {
|
|
|
5542
5589
|
return { navigationId };
|
|
5543
5590
|
}
|
|
5544
5591
|
}
|
|
5545
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
5546
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
5547
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
5592
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5593
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
|
|
5594
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: Router, decorators: [{
|
|
5548
5595
|
type: Injectable,
|
|
5549
5596
|
args: [{
|
|
5550
5597
|
providedIn: 'root',
|
|
@@ -5555,7 +5602,7 @@ function validateCommands(commands) {
|
|
|
5555
5602
|
for (let i = 0; i < commands.length; i++) {
|
|
5556
5603
|
const cmd = commands[i];
|
|
5557
5604
|
if (cmd == null) {
|
|
5558
|
-
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$
|
|
5605
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$2 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5559
5606
|
}
|
|
5560
5607
|
}
|
|
5561
5608
|
}
|
|
@@ -5674,11 +5721,50 @@ class RouterLink {
|
|
|
5674
5721
|
this.tabIndexAttribute = tabIndexAttribute;
|
|
5675
5722
|
this.renderer = renderer;
|
|
5676
5723
|
this.el = el;
|
|
5724
|
+
this._preserveFragment = false;
|
|
5725
|
+
this._skipLocationChange = false;
|
|
5726
|
+
this._replaceUrl = false;
|
|
5677
5727
|
this.commands = null;
|
|
5678
5728
|
/** @internal */
|
|
5679
5729
|
this.onChanges = new Subject();
|
|
5680
5730
|
this.setTabIndexIfNotOnNativeEl('0');
|
|
5681
5731
|
}
|
|
5732
|
+
/**
|
|
5733
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5734
|
+
* `UrlCreationOptions`.
|
|
5735
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5736
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5737
|
+
*/
|
|
5738
|
+
set preserveFragment(preserveFragment) {
|
|
5739
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5740
|
+
}
|
|
5741
|
+
get preserveFragment() {
|
|
5742
|
+
return this._preserveFragment;
|
|
5743
|
+
}
|
|
5744
|
+
/**
|
|
5745
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5746
|
+
* `NavigationBehaviorOptions`.
|
|
5747
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5748
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5749
|
+
*/
|
|
5750
|
+
set skipLocationChange(skipLocationChange) {
|
|
5751
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5752
|
+
}
|
|
5753
|
+
get skipLocationChange() {
|
|
5754
|
+
return this._skipLocationChange;
|
|
5755
|
+
}
|
|
5756
|
+
/**
|
|
5757
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5758
|
+
* `NavigationBehaviorOptions`.
|
|
5759
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5760
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5761
|
+
*/
|
|
5762
|
+
set replaceUrl(replaceUrl) {
|
|
5763
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5764
|
+
}
|
|
5765
|
+
get replaceUrl() {
|
|
5766
|
+
return this._replaceUrl;
|
|
5767
|
+
}
|
|
5682
5768
|
/**
|
|
5683
5769
|
* Modifies the tab index if there was not a tabindex attribute on the element during
|
|
5684
5770
|
* instantiation.
|
|
@@ -5725,8 +5811,8 @@ class RouterLink {
|
|
|
5725
5811
|
return true;
|
|
5726
5812
|
}
|
|
5727
5813
|
const extras = {
|
|
5728
|
-
skipLocationChange:
|
|
5729
|
-
replaceUrl:
|
|
5814
|
+
skipLocationChange: this.skipLocationChange,
|
|
5815
|
+
replaceUrl: this.replaceUrl,
|
|
5730
5816
|
state: this.state,
|
|
5731
5817
|
};
|
|
5732
5818
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5743,15 +5829,18 @@ class RouterLink {
|
|
|
5743
5829
|
queryParams: this.queryParams,
|
|
5744
5830
|
fragment: this.fragment,
|
|
5745
5831
|
queryParamsHandling: this.queryParamsHandling,
|
|
5746
|
-
preserveFragment:
|
|
5832
|
+
preserveFragment: this.preserveFragment,
|
|
5747
5833
|
});
|
|
5748
5834
|
}
|
|
5749
5835
|
}
|
|
5750
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
5751
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
5752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
5836
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5837
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-rc.0", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
5838
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLink, decorators: [{
|
|
5753
5839
|
type: Directive,
|
|
5754
|
-
args: [{
|
|
5840
|
+
args: [{
|
|
5841
|
+
selector: ':not(a):not(area)[routerLink]',
|
|
5842
|
+
standalone: true,
|
|
5843
|
+
}]
|
|
5755
5844
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
5756
5845
|
type: Attribute,
|
|
5757
5846
|
args: ['tabindex']
|
|
@@ -5761,16 +5850,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
5761
5850
|
type: Input
|
|
5762
5851
|
}], queryParamsHandling: [{
|
|
5763
5852
|
type: Input
|
|
5853
|
+
}], state: [{
|
|
5854
|
+
type: Input
|
|
5855
|
+
}], relativeTo: [{
|
|
5856
|
+
type: Input
|
|
5764
5857
|
}], preserveFragment: [{
|
|
5765
5858
|
type: Input
|
|
5766
5859
|
}], skipLocationChange: [{
|
|
5767
5860
|
type: Input
|
|
5768
5861
|
}], replaceUrl: [{
|
|
5769
5862
|
type: Input
|
|
5770
|
-
}], state: [{
|
|
5771
|
-
type: Input
|
|
5772
|
-
}], relativeTo: [{
|
|
5773
|
-
type: Input
|
|
5774
5863
|
}], routerLink: [{
|
|
5775
5864
|
type: Input
|
|
5776
5865
|
}], onClick: [{
|
|
@@ -5793,6 +5882,9 @@ class RouterLinkWithHref {
|
|
|
5793
5882
|
this.router = router;
|
|
5794
5883
|
this.route = route;
|
|
5795
5884
|
this.locationStrategy = locationStrategy;
|
|
5885
|
+
this._preserveFragment = false;
|
|
5886
|
+
this._skipLocationChange = false;
|
|
5887
|
+
this._replaceUrl = false;
|
|
5796
5888
|
this.commands = null;
|
|
5797
5889
|
// the url displayed on the anchor element.
|
|
5798
5890
|
// @HostBinding('attr.href') is used rather than @HostBinding() because it removes the
|
|
@@ -5806,6 +5898,42 @@ class RouterLinkWithHref {
|
|
|
5806
5898
|
}
|
|
5807
5899
|
});
|
|
5808
5900
|
}
|
|
5901
|
+
/**
|
|
5902
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5903
|
+
* `UrlCreationOptions`.
|
|
5904
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5905
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5906
|
+
*/
|
|
5907
|
+
set preserveFragment(preserveFragment) {
|
|
5908
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5909
|
+
}
|
|
5910
|
+
get preserveFragment() {
|
|
5911
|
+
return this._preserveFragment;
|
|
5912
|
+
}
|
|
5913
|
+
/**
|
|
5914
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5915
|
+
* `NavigationBehaviorOptions`.
|
|
5916
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5917
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5918
|
+
*/
|
|
5919
|
+
set skipLocationChange(skipLocationChange) {
|
|
5920
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5921
|
+
}
|
|
5922
|
+
get skipLocationChange() {
|
|
5923
|
+
return this._skipLocationChange;
|
|
5924
|
+
}
|
|
5925
|
+
/**
|
|
5926
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5927
|
+
* `NavigationBehaviorOptions`.
|
|
5928
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5929
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5930
|
+
*/
|
|
5931
|
+
set replaceUrl(replaceUrl) {
|
|
5932
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5933
|
+
}
|
|
5934
|
+
get replaceUrl() {
|
|
5935
|
+
return this._replaceUrl;
|
|
5936
|
+
}
|
|
5809
5937
|
/**
|
|
5810
5938
|
* Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
5811
5939
|
* - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
@@ -5839,8 +5967,8 @@ class RouterLinkWithHref {
|
|
|
5839
5967
|
return true;
|
|
5840
5968
|
}
|
|
5841
5969
|
const extras = {
|
|
5842
|
-
skipLocationChange:
|
|
5843
|
-
replaceUrl:
|
|
5970
|
+
skipLocationChange: this.skipLocationChange,
|
|
5971
|
+
replaceUrl: this.replaceUrl,
|
|
5844
5972
|
state: this.state
|
|
5845
5973
|
};
|
|
5846
5974
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5862,15 +5990,15 @@ class RouterLinkWithHref {
|
|
|
5862
5990
|
queryParams: this.queryParams,
|
|
5863
5991
|
fragment: this.fragment,
|
|
5864
5992
|
queryParamsHandling: this.queryParamsHandling,
|
|
5865
|
-
preserveFragment:
|
|
5993
|
+
preserveFragment: this.preserveFragment,
|
|
5866
5994
|
});
|
|
5867
5995
|
}
|
|
5868
5996
|
}
|
|
5869
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
5870
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
5871
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
5997
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5998
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-rc.0", type: RouterLinkWithHref, isStandalone: true, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", 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 });
|
|
5999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5872
6000
|
type: Directive,
|
|
5873
|
-
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
6001
|
+
args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
|
|
5874
6002
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
5875
6003
|
type: HostBinding,
|
|
5876
6004
|
args: ['attr.target']
|
|
@@ -5882,12 +6010,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
5882
6010
|
type: Input
|
|
5883
6011
|
}], queryParamsHandling: [{
|
|
5884
6012
|
type: Input
|
|
5885
|
-
}], preserveFragment: [{
|
|
5886
|
-
type: Input
|
|
5887
|
-
}], skipLocationChange: [{
|
|
5888
|
-
type: Input
|
|
5889
|
-
}], replaceUrl: [{
|
|
5890
|
-
type: Input
|
|
5891
6013
|
}], state: [{
|
|
5892
6014
|
type: Input
|
|
5893
6015
|
}], relativeTo: [{
|
|
@@ -5895,6 +6017,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
5895
6017
|
}], href: [{
|
|
5896
6018
|
type: HostBinding,
|
|
5897
6019
|
args: ['attr.href']
|
|
6020
|
+
}], preserveFragment: [{
|
|
6021
|
+
type: Input
|
|
6022
|
+
}], skipLocationChange: [{
|
|
6023
|
+
type: Input
|
|
6024
|
+
}], replaceUrl: [{
|
|
6025
|
+
type: Input
|
|
5898
6026
|
}], routerLink: [{
|
|
5899
6027
|
type: Input
|
|
5900
6028
|
}], onClick: [{
|
|
@@ -6093,13 +6221,14 @@ class RouterLinkActive {
|
|
|
6093
6221
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
6094
6222
|
}
|
|
6095
6223
|
}
|
|
6096
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6097
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
6098
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6224
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
6225
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-rc.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
6226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
6099
6227
|
type: Directive,
|
|
6100
6228
|
args: [{
|
|
6101
6229
|
selector: '[routerLinkActive]',
|
|
6102
6230
|
exportAs: 'routerLinkActive',
|
|
6231
|
+
standalone: true,
|
|
6103
6232
|
}]
|
|
6104
6233
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
|
|
6105
6234
|
type: Optional
|
|
@@ -6159,9 +6288,9 @@ class PreloadAllModules {
|
|
|
6159
6288
|
return fn().pipe(catchError(() => of(null)));
|
|
6160
6289
|
}
|
|
6161
6290
|
}
|
|
6162
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6163
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6291
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6292
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6293
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6165
6294
|
type: Injectable,
|
|
6166
6295
|
args: [{ providedIn: 'root' }]
|
|
6167
6296
|
}] });
|
|
@@ -6179,9 +6308,9 @@ class NoPreloading {
|
|
|
6179
6308
|
return of(null);
|
|
6180
6309
|
}
|
|
6181
6310
|
}
|
|
6182
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6183
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6184
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6311
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6312
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6185
6314
|
type: Injectable,
|
|
6186
6315
|
args: [{ providedIn: 'root' }]
|
|
6187
6316
|
}] });
|
|
@@ -6275,10 +6404,11 @@ class RouterPreloader {
|
|
|
6275
6404
|
});
|
|
6276
6405
|
}
|
|
6277
6406
|
}
|
|
6278
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6279
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6280
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6281
|
-
type: Injectable
|
|
6407
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6408
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
|
|
6409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6410
|
+
type: Injectable,
|
|
6411
|
+
args: [{ providedIn: 'root' }]
|
|
6282
6412
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6283
6413
|
|
|
6284
6414
|
/**
|
|
@@ -6364,12 +6494,421 @@ class RouterScroller {
|
|
|
6364
6494
|
}
|
|
6365
6495
|
}
|
|
6366
6496
|
}
|
|
6367
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6368
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6369
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6497
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6498
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterScroller });
|
|
6499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6370
6500
|
type: Injectable
|
|
6371
6501
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6372
6502
|
|
|
6503
|
+
/**
|
|
6504
|
+
* @license
|
|
6505
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6506
|
+
*
|
|
6507
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6508
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6509
|
+
*/
|
|
6510
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6511
|
+
/**
|
|
6512
|
+
* Sets up providers necessary to enable `Router` functionality for the application.
|
|
6513
|
+
* Allows to configure a set of routes as well as extra features that should be enabled.
|
|
6514
|
+
*
|
|
6515
|
+
* @usageNotes
|
|
6516
|
+
*
|
|
6517
|
+
* Basic example of how you can add a Router to your application:
|
|
6518
|
+
* ```
|
|
6519
|
+
* const appRoutes: Routes = [];
|
|
6520
|
+
* bootstrapApplication(AppComponent, {
|
|
6521
|
+
* providers: [provideRouter(appRoutes)]
|
|
6522
|
+
* });
|
|
6523
|
+
* ```
|
|
6524
|
+
*
|
|
6525
|
+
* You can also enable optional features in the Router by adding functions from the `RouterFeatures`
|
|
6526
|
+
* type:
|
|
6527
|
+
* ```
|
|
6528
|
+
* const appRoutes: Routes = [];
|
|
6529
|
+
* bootstrapApplication(AppComponent,
|
|
6530
|
+
* {
|
|
6531
|
+
* providers: [
|
|
6532
|
+
* provideRouter(appRoutes,
|
|
6533
|
+
* withDebugTracing(),
|
|
6534
|
+
* withRouterConfig({paramsInheritanceStrategy: 'always'}))
|
|
6535
|
+
* ]
|
|
6536
|
+
* }
|
|
6537
|
+
* );
|
|
6538
|
+
* ```
|
|
6539
|
+
*
|
|
6540
|
+
* @see `RouterFeatures`
|
|
6541
|
+
*
|
|
6542
|
+
* @publicApi
|
|
6543
|
+
* @developerPreview
|
|
6544
|
+
* @param routes A set of `Route`s to use for the application routing table.
|
|
6545
|
+
* @param features Optional features to configure additional router behaviors.
|
|
6546
|
+
* @returns A set of providers to setup a Router.
|
|
6547
|
+
*/
|
|
6548
|
+
function provideRouter(routes, ...features) {
|
|
6549
|
+
return [
|
|
6550
|
+
provideRoutes(routes), { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6551
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
6552
|
+
features.map(feature => feature.ɵproviders),
|
|
6553
|
+
// TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
|
|
6554
|
+
// how we want them to be configured. This API doesn't currently have a way to configure them
|
|
6555
|
+
// and we should decide what the _best_ way to do that is rather than just sticking with the
|
|
6556
|
+
// status quo of how it's done today.
|
|
6557
|
+
];
|
|
6558
|
+
}
|
|
6559
|
+
function rootRoute(router) {
|
|
6560
|
+
return router.routerState.root;
|
|
6561
|
+
}
|
|
6562
|
+
/**
|
|
6563
|
+
* Helper function to create an object that represents a Router feature.
|
|
6564
|
+
*/
|
|
6565
|
+
function routerFeature(kind, providers) {
|
|
6566
|
+
return { ɵkind: kind, ɵproviders: providers };
|
|
6567
|
+
}
|
|
6568
|
+
/**
|
|
6569
|
+
* Registers a [DI provider](guide/glossary#provider) for a set of routes.
|
|
6570
|
+
* @param routes The route configuration to provide.
|
|
6571
|
+
*
|
|
6572
|
+
* @usageNotes
|
|
6573
|
+
*
|
|
6574
|
+
* ```
|
|
6575
|
+
* @NgModule({
|
|
6576
|
+
* providers: [provideRoutes(ROUTES)]
|
|
6577
|
+
* })
|
|
6578
|
+
* class LazyLoadedChildModule {}
|
|
6579
|
+
* ```
|
|
6580
|
+
*
|
|
6581
|
+
* @publicApi
|
|
6582
|
+
*/
|
|
6583
|
+
function provideRoutes(routes) {
|
|
6584
|
+
return [
|
|
6585
|
+
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6586
|
+
];
|
|
6587
|
+
}
|
|
6588
|
+
/**
|
|
6589
|
+
* Enables customizable scrolling behavior for router navigations.
|
|
6590
|
+
*
|
|
6591
|
+
* @usageNotes
|
|
6592
|
+
*
|
|
6593
|
+
* Basic example of how you can enable scrolling feature:
|
|
6594
|
+
* ```
|
|
6595
|
+
* const appRoutes: Routes = [];
|
|
6596
|
+
* bootstrapApplication(AppComponent,
|
|
6597
|
+
* {
|
|
6598
|
+
* providers: [
|
|
6599
|
+
* provideRouter(appRoutes, withInMemoryScrolling())
|
|
6600
|
+
* ]
|
|
6601
|
+
* }
|
|
6602
|
+
* );
|
|
6603
|
+
* ```
|
|
6604
|
+
*
|
|
6605
|
+
* @see `provideRouter`
|
|
6606
|
+
* @see `ViewportScroller`
|
|
6607
|
+
*
|
|
6608
|
+
* @publicApi
|
|
6609
|
+
* @developerPreview
|
|
6610
|
+
* @param options Set of configuration parameters to customize scrolling behavior, see
|
|
6611
|
+
* `InMemoryScrollingOptions` for additional information.
|
|
6612
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6613
|
+
*/
|
|
6614
|
+
function withInMemoryScrolling(options = {}) {
|
|
6615
|
+
const providers = [{
|
|
6616
|
+
provide: ROUTER_SCROLLER,
|
|
6617
|
+
useFactory: () => {
|
|
6618
|
+
const router = inject(Router);
|
|
6619
|
+
const viewportScroller = inject(ViewportScroller);
|
|
6620
|
+
return new RouterScroller(router, viewportScroller, options);
|
|
6621
|
+
},
|
|
6622
|
+
}];
|
|
6623
|
+
return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
|
|
6624
|
+
}
|
|
6625
|
+
function getBootstrapListener() {
|
|
6626
|
+
const injector = inject(Injector);
|
|
6627
|
+
return (bootstrappedComponentRef) => {
|
|
6628
|
+
const ref = injector.get(ApplicationRef);
|
|
6629
|
+
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6630
|
+
return;
|
|
6631
|
+
}
|
|
6632
|
+
const router = injector.get(Router);
|
|
6633
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6634
|
+
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6635
|
+
router.initialNavigation();
|
|
6636
|
+
}
|
|
6637
|
+
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
6638
|
+
injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
|
|
6639
|
+
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6640
|
+
bootstrapDone.next();
|
|
6641
|
+
bootstrapDone.complete();
|
|
6642
|
+
};
|
|
6643
|
+
}
|
|
6644
|
+
/**
|
|
6645
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6646
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6647
|
+
* to the activation phase.
|
|
6648
|
+
*/
|
|
6649
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE$1 ? 'bootstrap done indicator' : '', {
|
|
6650
|
+
factory: () => {
|
|
6651
|
+
return new Subject();
|
|
6652
|
+
}
|
|
6653
|
+
});
|
|
6654
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE$1 ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6655
|
+
/**
|
|
6656
|
+
* Configures initial navigation to start before the root component is created.
|
|
6657
|
+
*
|
|
6658
|
+
* The bootstrap is blocked until the initial navigation is complete. This value is required for
|
|
6659
|
+
* [server-side rendering](guide/universal) to work.
|
|
6660
|
+
*
|
|
6661
|
+
* @usageNotes
|
|
6662
|
+
*
|
|
6663
|
+
* Basic example of how you can enable this navigation behavior:
|
|
6664
|
+
* ```
|
|
6665
|
+
* const appRoutes: Routes = [];
|
|
6666
|
+
* bootstrapApplication(AppComponent,
|
|
6667
|
+
* {
|
|
6668
|
+
* providers: [
|
|
6669
|
+
* provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
|
|
6670
|
+
* ]
|
|
6671
|
+
* }
|
|
6672
|
+
* );
|
|
6673
|
+
* ```
|
|
6674
|
+
*
|
|
6675
|
+
* @see `provideRouter`
|
|
6676
|
+
*
|
|
6677
|
+
* @publicApi
|
|
6678
|
+
* @developerPreview
|
|
6679
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6680
|
+
*/
|
|
6681
|
+
function withEnabledBlockingInitialNavigation() {
|
|
6682
|
+
const providers = [
|
|
6683
|
+
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6684
|
+
{
|
|
6685
|
+
provide: APP_INITIALIZER,
|
|
6686
|
+
multi: true,
|
|
6687
|
+
deps: [Injector],
|
|
6688
|
+
useFactory: (injector) => {
|
|
6689
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6690
|
+
let initNavigation = false;
|
|
6691
|
+
/**
|
|
6692
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6693
|
+
*
|
|
6694
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6695
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6696
|
+
*/
|
|
6697
|
+
function afterNextNavigation(action) {
|
|
6698
|
+
const router = injector.get(Router);
|
|
6699
|
+
router.events
|
|
6700
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6701
|
+
e instanceof NavigationError), map(e => {
|
|
6702
|
+
if (e instanceof NavigationEnd) {
|
|
6703
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6704
|
+
return true;
|
|
6705
|
+
}
|
|
6706
|
+
const redirecting = e instanceof NavigationCancel ?
|
|
6707
|
+
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6708
|
+
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6709
|
+
false;
|
|
6710
|
+
return redirecting ? null : false;
|
|
6711
|
+
}), filter((result) => result !== null), take(1))
|
|
6712
|
+
.subscribe(() => {
|
|
6713
|
+
action();
|
|
6714
|
+
});
|
|
6715
|
+
}
|
|
6716
|
+
return () => {
|
|
6717
|
+
return locationInitialized.then(() => {
|
|
6718
|
+
return new Promise(resolve => {
|
|
6719
|
+
const router = injector.get(Router);
|
|
6720
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6721
|
+
afterNextNavigation(() => {
|
|
6722
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6723
|
+
// without a redirect.
|
|
6724
|
+
resolve(true);
|
|
6725
|
+
initNavigation = true;
|
|
6726
|
+
});
|
|
6727
|
+
router.afterPreactivation = () => {
|
|
6728
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6729
|
+
// assume activation will complete successfully (even though this is not
|
|
6730
|
+
// guaranteed).
|
|
6731
|
+
resolve(true);
|
|
6732
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6733
|
+
if (!initNavigation) {
|
|
6734
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6735
|
+
// subsequent navigations should not be delayed
|
|
6736
|
+
}
|
|
6737
|
+
else {
|
|
6738
|
+
return of(void 0);
|
|
6739
|
+
}
|
|
6740
|
+
};
|
|
6741
|
+
router.initialNavigation();
|
|
6742
|
+
});
|
|
6743
|
+
});
|
|
6744
|
+
};
|
|
6745
|
+
}
|
|
6746
|
+
},
|
|
6747
|
+
];
|
|
6748
|
+
return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);
|
|
6749
|
+
}
|
|
6750
|
+
/**
|
|
6751
|
+
* Disables initial navigation.
|
|
6752
|
+
*
|
|
6753
|
+
* Use if there is a reason to have more control over when the router starts its initial navigation
|
|
6754
|
+
* due to some complex initialization logic.
|
|
6755
|
+
*
|
|
6756
|
+
* @usageNotes
|
|
6757
|
+
*
|
|
6758
|
+
* Basic example of how you can disable initial navigation:
|
|
6759
|
+
* ```
|
|
6760
|
+
* const appRoutes: Routes = [];
|
|
6761
|
+
* bootstrapApplication(AppComponent,
|
|
6762
|
+
* {
|
|
6763
|
+
* providers: [
|
|
6764
|
+
* provideRouter(appRoutes, withDisabledInitialNavigation())
|
|
6765
|
+
* ]
|
|
6766
|
+
* }
|
|
6767
|
+
* );
|
|
6768
|
+
* ```
|
|
6769
|
+
*
|
|
6770
|
+
* @see `provideRouter`
|
|
6771
|
+
*
|
|
6772
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6773
|
+
*
|
|
6774
|
+
* @publicApi
|
|
6775
|
+
* @developerPreview
|
|
6776
|
+
*/
|
|
6777
|
+
function withDisabledInitialNavigation() {
|
|
6778
|
+
const providers = [
|
|
6779
|
+
{
|
|
6780
|
+
provide: APP_INITIALIZER,
|
|
6781
|
+
multi: true,
|
|
6782
|
+
useFactory: () => {
|
|
6783
|
+
const router = inject(Router);
|
|
6784
|
+
return () => {
|
|
6785
|
+
router.setUpLocationChangeListener();
|
|
6786
|
+
};
|
|
6787
|
+
}
|
|
6788
|
+
},
|
|
6789
|
+
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6790
|
+
];
|
|
6791
|
+
return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);
|
|
6792
|
+
}
|
|
6793
|
+
/**
|
|
6794
|
+
* Enables logging of all internal navigation events to the console.
|
|
6795
|
+
* Extra logging might be useful for debugging purposes to inspect Router event sequence.
|
|
6796
|
+
*
|
|
6797
|
+
* @usageNotes
|
|
6798
|
+
*
|
|
6799
|
+
* Basic example of how you can enable debug tracing:
|
|
6800
|
+
* ```
|
|
6801
|
+
* const appRoutes: Routes = [];
|
|
6802
|
+
* bootstrapApplication(AppComponent,
|
|
6803
|
+
* {
|
|
6804
|
+
* providers: [
|
|
6805
|
+
* provideRouter(appRoutes, withDebugTracing())
|
|
6806
|
+
* ]
|
|
6807
|
+
* }
|
|
6808
|
+
* );
|
|
6809
|
+
* ```
|
|
6810
|
+
*
|
|
6811
|
+
* @see `provideRouter`
|
|
6812
|
+
*
|
|
6813
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6814
|
+
*
|
|
6815
|
+
* @publicApi
|
|
6816
|
+
* @developerPreview
|
|
6817
|
+
*/
|
|
6818
|
+
function withDebugTracing() {
|
|
6819
|
+
let providers = [];
|
|
6820
|
+
if (NG_DEV_MODE$1) {
|
|
6821
|
+
providers = [{
|
|
6822
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6823
|
+
multi: true,
|
|
6824
|
+
useFactory: () => {
|
|
6825
|
+
const router = inject(Router);
|
|
6826
|
+
return () => router.events.subscribe((e) => {
|
|
6827
|
+
// tslint:disable:no-console
|
|
6828
|
+
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6829
|
+
console.log(stringifyEvent(e));
|
|
6830
|
+
console.log(e);
|
|
6831
|
+
console.groupEnd?.();
|
|
6832
|
+
// tslint:enable:no-console
|
|
6833
|
+
});
|
|
6834
|
+
}
|
|
6835
|
+
}];
|
|
6836
|
+
}
|
|
6837
|
+
else {
|
|
6838
|
+
providers = [];
|
|
6839
|
+
}
|
|
6840
|
+
return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
|
|
6841
|
+
}
|
|
6842
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE$1 ? 'router preloader' : '');
|
|
6843
|
+
/**
|
|
6844
|
+
* Allows to configure a preloading strategy to use. The strategy is configured by providing a
|
|
6845
|
+
* reference to a class that implements a `PreloadingStrategy`.
|
|
6846
|
+
*
|
|
6847
|
+
* @usageNotes
|
|
6848
|
+
*
|
|
6849
|
+
* Basic example of how you can configure preloading:
|
|
6850
|
+
* ```
|
|
6851
|
+
* const appRoutes: Routes = [];
|
|
6852
|
+
* bootstrapApplication(AppComponent,
|
|
6853
|
+
* {
|
|
6854
|
+
* providers: [
|
|
6855
|
+
* provideRouter(appRoutes, withPreloading(PreloadAllModules))
|
|
6856
|
+
* ]
|
|
6857
|
+
* }
|
|
6858
|
+
* );
|
|
6859
|
+
* ```
|
|
6860
|
+
*
|
|
6861
|
+
* @see `provideRouter`
|
|
6862
|
+
*
|
|
6863
|
+
* @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
|
|
6864
|
+
* should be used.
|
|
6865
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6866
|
+
*
|
|
6867
|
+
* @publicApi
|
|
6868
|
+
* @developerPreview
|
|
6869
|
+
*/
|
|
6870
|
+
function withPreloading(preloadingStrategy) {
|
|
6871
|
+
const providers = [
|
|
6872
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6873
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6874
|
+
];
|
|
6875
|
+
return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);
|
|
6876
|
+
}
|
|
6877
|
+
/**
|
|
6878
|
+
* Allows to provide extra parameters to configure Router.
|
|
6879
|
+
*
|
|
6880
|
+
* @usageNotes
|
|
6881
|
+
*
|
|
6882
|
+
* Basic example of how you can provide extra configuration options:
|
|
6883
|
+
* ```
|
|
6884
|
+
* const appRoutes: Routes = [];
|
|
6885
|
+
* bootstrapApplication(AppComponent,
|
|
6886
|
+
* {
|
|
6887
|
+
* providers: [
|
|
6888
|
+
* provideRouter(appRoutes, withRouterConfig({
|
|
6889
|
+
* onSameUrlNavigation: 'reload'
|
|
6890
|
+
* }))
|
|
6891
|
+
* ]
|
|
6892
|
+
* }
|
|
6893
|
+
* );
|
|
6894
|
+
* ```
|
|
6895
|
+
*
|
|
6896
|
+
* @see `provideRouter`
|
|
6897
|
+
*
|
|
6898
|
+
* @param options A set of parameters to configure Router, see `RouterConfigOptions` for
|
|
6899
|
+
* additional information.
|
|
6900
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6901
|
+
*
|
|
6902
|
+
* @publicApi
|
|
6903
|
+
* @developerPreview
|
|
6904
|
+
*/
|
|
6905
|
+
function withRouterConfig(options) {
|
|
6906
|
+
const providers = [
|
|
6907
|
+
{ provide: ROUTER_CONFIGURATION, useValue: options },
|
|
6908
|
+
];
|
|
6909
|
+
return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);
|
|
6910
|
+
}
|
|
6911
|
+
|
|
6373
6912
|
/**
|
|
6374
6913
|
* @license
|
|
6375
6914
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6386,7 +6925,6 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6386
6925
|
* @docsNotRequired
|
|
6387
6926
|
*/
|
|
6388
6927
|
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6389
|
-
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6390
6928
|
// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
|
|
6391
6929
|
// here to avoid a breaking change whereby the provider order matters based on where the
|
|
6392
6930
|
// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
|
|
@@ -6399,9 +6937,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6399
6937
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6400
6938
|
RouterConfigLoader,
|
|
6401
6939
|
];
|
|
6402
|
-
function rootRoute(router) {
|
|
6403
|
-
return router.routerState.root;
|
|
6404
|
-
}
|
|
6405
6940
|
function routerNgProbeToken() {
|
|
6406
6941
|
return new NgProbeToken('Router', Router);
|
|
6407
6942
|
}
|
|
@@ -6451,7 +6986,7 @@ class RouterModule {
|
|
|
6451
6986
|
ngModule: RouterModule,
|
|
6452
6987
|
providers: [
|
|
6453
6988
|
ROUTER_PROVIDERS,
|
|
6454
|
-
NG_DEV_MODE ? (config?.enableTracing ?
|
|
6989
|
+
NG_DEV_MODE ? (config?.enableTracing ? withDebugTracing().ɵproviders : []) : [],
|
|
6455
6990
|
provideRoutes(routes),
|
|
6456
6991
|
{
|
|
6457
6992
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6461,7 +6996,7 @@ class RouterModule {
|
|
|
6461
6996
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6462
6997
|
config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6463
6998
|
provideRouterScroller(),
|
|
6464
|
-
config?.preloadingStrategy ?
|
|
6999
|
+
config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).ɵproviders : [],
|
|
6465
7000
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6466
7001
|
config?.initialNavigation ? provideInitialNavigation(config) : [],
|
|
6467
7002
|
provideRouterInitializer(),
|
|
@@ -6488,13 +7023,13 @@ class RouterModule {
|
|
|
6488
7023
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6489
7024
|
}
|
|
6490
7025
|
}
|
|
6491
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6492
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
|
|
6493
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.
|
|
6494
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
7026
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
7027
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
7028
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
|
|
7029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterModule, decorators: [{
|
|
6495
7030
|
type: NgModule,
|
|
6496
7031
|
args: [{
|
|
6497
|
-
|
|
7032
|
+
imports: ROUTER_DIRECTIVES,
|
|
6498
7033
|
exports: ROUTER_DIRECTIVES,
|
|
6499
7034
|
}]
|
|
6500
7035
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
@@ -6503,6 +7038,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
6503
7038
|
type: Inject,
|
|
6504
7039
|
args: [ROUTER_FORROOT_GUARD]
|
|
6505
7040
|
}] }]; } });
|
|
7041
|
+
/**
|
|
7042
|
+
* For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`
|
|
7043
|
+
* because it reads from the `ExtraOptions` which should not be used in the standalone world.
|
|
7044
|
+
*/
|
|
6506
7045
|
function provideRouterScroller() {
|
|
6507
7046
|
return {
|
|
6508
7047
|
provide: ROUTER_SCROLLER,
|
|
@@ -6517,9 +7056,13 @@ function provideRouterScroller() {
|
|
|
6517
7056
|
},
|
|
6518
7057
|
};
|
|
6519
7058
|
}
|
|
7059
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should
|
|
7060
|
+
// provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.
|
|
6520
7061
|
function provideHashLocationStrategy() {
|
|
6521
7062
|
return { provide: LocationStrategy, useClass: HashLocationStrategy };
|
|
6522
7063
|
}
|
|
7064
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not
|
|
7065
|
+
// need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.
|
|
6523
7066
|
function providePathLocationStrategy() {
|
|
6524
7067
|
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6525
7068
|
}
|
|
@@ -6530,46 +7073,16 @@ function provideForRootGuard(router) {
|
|
|
6530
7073
|
}
|
|
6531
7074
|
return 'guarded';
|
|
6532
7075
|
}
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
*
|
|
6537
|
-
* @usageNotes
|
|
6538
|
-
*
|
|
6539
|
-
* ```
|
|
6540
|
-
* @NgModule({
|
|
6541
|
-
* imports: [RouterModule.forChild(ROUTES)],
|
|
6542
|
-
* providers: [provideRoutes(EXTRA_ROUTES)]
|
|
6543
|
-
* })
|
|
6544
|
-
* class MyNgModule {}
|
|
6545
|
-
* ```
|
|
6546
|
-
*
|
|
6547
|
-
* @publicApi
|
|
6548
|
-
*/
|
|
6549
|
-
function provideRoutes(routes) {
|
|
7076
|
+
// Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`
|
|
7077
|
+
// users call `withXInitialNavigation` directly.
|
|
7078
|
+
function provideInitialNavigation(config) {
|
|
6550
7079
|
return [
|
|
6551
|
-
|
|
7080
|
+
config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [],
|
|
7081
|
+
config.initialNavigation === 'enabledBlocking' ?
|
|
7082
|
+
withEnabledBlockingInitialNavigation().ɵproviders :
|
|
7083
|
+
[],
|
|
6552
7084
|
];
|
|
6553
7085
|
}
|
|
6554
|
-
function getBootstrapListener() {
|
|
6555
|
-
const injector = inject(Injector);
|
|
6556
|
-
return (bootstrappedComponentRef) => {
|
|
6557
|
-
const ref = injector.get(ApplicationRef);
|
|
6558
|
-
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6559
|
-
return;
|
|
6560
|
-
}
|
|
6561
|
-
const router = injector.get(Router);
|
|
6562
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6563
|
-
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6564
|
-
router.initialNavigation();
|
|
6565
|
-
}
|
|
6566
|
-
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
6567
|
-
injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
|
|
6568
|
-
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6569
|
-
bootstrapDone.next();
|
|
6570
|
-
bootstrapDone.complete();
|
|
6571
|
-
};
|
|
6572
|
-
}
|
|
6573
7086
|
// TODO(atscott): This should not be in the public API
|
|
6574
7087
|
/**
|
|
6575
7088
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
@@ -6578,12 +7091,6 @@ function getBootstrapListener() {
|
|
|
6578
7091
|
* @publicApi
|
|
6579
7092
|
*/
|
|
6580
7093
|
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6581
|
-
function provideInitialNavigation(config) {
|
|
6582
|
-
return [
|
|
6583
|
-
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6584
|
-
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6585
|
-
];
|
|
6586
|
-
}
|
|
6587
7094
|
function provideRouterInitializer() {
|
|
6588
7095
|
return [
|
|
6589
7096
|
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
@@ -6592,129 +7099,6 @@ function provideRouterInitializer() {
|
|
|
6592
7099
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6593
7100
|
];
|
|
6594
7101
|
}
|
|
6595
|
-
/**
|
|
6596
|
-
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6597
|
-
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6598
|
-
* to the activation phase.
|
|
6599
|
-
*/
|
|
6600
|
-
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6601
|
-
factory: () => {
|
|
6602
|
-
return new Subject();
|
|
6603
|
-
}
|
|
6604
|
-
});
|
|
6605
|
-
function provideEnabledBlockingInitialNavigation() {
|
|
6606
|
-
return [
|
|
6607
|
-
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6608
|
-
{
|
|
6609
|
-
provide: APP_INITIALIZER,
|
|
6610
|
-
multi: true,
|
|
6611
|
-
deps: [Injector],
|
|
6612
|
-
useFactory: (injector) => {
|
|
6613
|
-
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6614
|
-
let initNavigation = false;
|
|
6615
|
-
/**
|
|
6616
|
-
* Performs the given action once the router finishes its next/current navigation.
|
|
6617
|
-
*
|
|
6618
|
-
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6619
|
-
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6620
|
-
*/
|
|
6621
|
-
function afterNextNavigation(action) {
|
|
6622
|
-
const router = injector.get(Router);
|
|
6623
|
-
router.events
|
|
6624
|
-
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6625
|
-
e instanceof NavigationError), map(e => {
|
|
6626
|
-
if (e instanceof NavigationEnd) {
|
|
6627
|
-
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6628
|
-
return true;
|
|
6629
|
-
}
|
|
6630
|
-
const redirecting = e instanceof NavigationCancel ?
|
|
6631
|
-
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6632
|
-
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6633
|
-
false;
|
|
6634
|
-
return redirecting ? null : false;
|
|
6635
|
-
}), filter((result) => result !== null), take(1))
|
|
6636
|
-
.subscribe(() => {
|
|
6637
|
-
action();
|
|
6638
|
-
});
|
|
6639
|
-
}
|
|
6640
|
-
return () => {
|
|
6641
|
-
return locationInitialized.then(() => {
|
|
6642
|
-
return new Promise(resolve => {
|
|
6643
|
-
const router = injector.get(Router);
|
|
6644
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6645
|
-
afterNextNavigation(() => {
|
|
6646
|
-
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6647
|
-
// without a redirect.
|
|
6648
|
-
resolve(true);
|
|
6649
|
-
initNavigation = true;
|
|
6650
|
-
});
|
|
6651
|
-
router.afterPreactivation = () => {
|
|
6652
|
-
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6653
|
-
// assume activation will complete successfully (even though this is not
|
|
6654
|
-
// guaranteed).
|
|
6655
|
-
resolve(true);
|
|
6656
|
-
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6657
|
-
if (!initNavigation) {
|
|
6658
|
-
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6659
|
-
// subsequent navigations should not be delayed
|
|
6660
|
-
}
|
|
6661
|
-
else {
|
|
6662
|
-
return of(void 0);
|
|
6663
|
-
}
|
|
6664
|
-
};
|
|
6665
|
-
router.initialNavigation();
|
|
6666
|
-
});
|
|
6667
|
-
});
|
|
6668
|
-
};
|
|
6669
|
-
}
|
|
6670
|
-
},
|
|
6671
|
-
];
|
|
6672
|
-
}
|
|
6673
|
-
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6674
|
-
function provideDisabledInitialNavigation() {
|
|
6675
|
-
return [
|
|
6676
|
-
{
|
|
6677
|
-
provide: APP_INITIALIZER,
|
|
6678
|
-
multi: true,
|
|
6679
|
-
useFactory: () => {
|
|
6680
|
-
const router = inject(Router);
|
|
6681
|
-
return () => {
|
|
6682
|
-
router.setUpLocationChangeListener();
|
|
6683
|
-
};
|
|
6684
|
-
}
|
|
6685
|
-
},
|
|
6686
|
-
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6687
|
-
];
|
|
6688
|
-
}
|
|
6689
|
-
function provideTracing() {
|
|
6690
|
-
if (NG_DEV_MODE) {
|
|
6691
|
-
return [{
|
|
6692
|
-
provide: ENVIRONMENT_INITIALIZER,
|
|
6693
|
-
multi: true,
|
|
6694
|
-
useFactory: () => {
|
|
6695
|
-
const router = inject(Router);
|
|
6696
|
-
return () => router.events.subscribe((e) => {
|
|
6697
|
-
// tslint:disable:no-console
|
|
6698
|
-
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6699
|
-
console.log(stringifyEvent(e));
|
|
6700
|
-
console.log(e);
|
|
6701
|
-
console.groupEnd?.();
|
|
6702
|
-
// tslint:enable:no-console
|
|
6703
|
-
});
|
|
6704
|
-
}
|
|
6705
|
-
}];
|
|
6706
|
-
}
|
|
6707
|
-
else {
|
|
6708
|
-
return [];
|
|
6709
|
-
}
|
|
6710
|
-
}
|
|
6711
|
-
function providePreloading(preloadingStrategy) {
|
|
6712
|
-
return [
|
|
6713
|
-
RouterPreloader,
|
|
6714
|
-
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6715
|
-
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6716
|
-
];
|
|
6717
|
-
}
|
|
6718
7102
|
|
|
6719
7103
|
/**
|
|
6720
7104
|
* @license
|
|
@@ -6726,7 +7110,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6726
7110
|
/**
|
|
6727
7111
|
* @publicApi
|
|
6728
7112
|
*/
|
|
6729
|
-
const VERSION = new Version('14.
|
|
7113
|
+
const VERSION = new Version('14.2.0-rc.0');
|
|
6730
7114
|
|
|
6731
7115
|
/**
|
|
6732
7116
|
* @license
|
|
@@ -6765,5 +7149,5 @@ const VERSION = new Version('14.1.3');
|
|
|
6765
7149
|
* Generated bundle index. Do not edit.
|
|
6766
7150
|
*/
|
|
6767
7151
|
|
|
6768
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten,
|
|
7152
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
|
|
6769
7153
|
//# sourceMappingURL=router.mjs.map
|