@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/fesm2015/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
|
*
|
|
@@ -984,11 +1004,11 @@ class Navigation {
|
|
|
984
1004
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
985
1005
|
this.commands = commands;
|
|
986
1006
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
987
|
-
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$
|
|
1007
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
|
|
988
1008
|
}
|
|
989
1009
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
990
1010
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
991
|
-
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$
|
|
1011
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
|
|
992
1012
|
}
|
|
993
1013
|
}
|
|
994
1014
|
toRoot() {
|
|
@@ -1087,7 +1107,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1087
1107
|
dd -= ci;
|
|
1088
1108
|
g = g.parent;
|
|
1089
1109
|
if (!g) {
|
|
1090
|
-
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$
|
|
1110
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
|
|
1091
1111
|
}
|
|
1092
1112
|
ci = g.segments.length;
|
|
1093
1113
|
}
|
|
@@ -1911,6 +1931,7 @@ class ActivatedRoute {
|
|
|
1911
1931
|
outlet,
|
|
1912
1932
|
/** The component of the route, a constant. */
|
|
1913
1933
|
component, futureSnapshot) {
|
|
1934
|
+
var _a, _b;
|
|
1914
1935
|
this.url = url;
|
|
1915
1936
|
this.params = params;
|
|
1916
1937
|
this.queryParams = queryParams;
|
|
@@ -1918,6 +1939,8 @@ class ActivatedRoute {
|
|
|
1918
1939
|
this.data = data;
|
|
1919
1940
|
this.outlet = outlet;
|
|
1920
1941
|
this.component = component;
|
|
1942
|
+
/** An Observable of the resolved route title */
|
|
1943
|
+
this.title = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.pipe(map((d) => d[RouteTitleKey]))) !== null && _b !== void 0 ? _b : of(undefined);
|
|
1921
1944
|
this._futureSnapshot = futureSnapshot;
|
|
1922
1945
|
}
|
|
1923
1946
|
/** The configuration used to match this route. */
|
|
@@ -2066,6 +2089,7 @@ class ActivatedRouteSnapshot {
|
|
|
2066
2089
|
outlet,
|
|
2067
2090
|
/** The component of the route */
|
|
2068
2091
|
component, routeConfig, urlSegment, lastPathIndex, resolve, correctedLastPathIndex) {
|
|
2092
|
+
var _a;
|
|
2069
2093
|
this.url = url;
|
|
2070
2094
|
this.params = params;
|
|
2071
2095
|
this.queryParams = queryParams;
|
|
@@ -2073,6 +2097,8 @@ class ActivatedRouteSnapshot {
|
|
|
2073
2097
|
this.data = data;
|
|
2074
2098
|
this.outlet = outlet;
|
|
2075
2099
|
this.component = component;
|
|
2100
|
+
/** The resolved route title */
|
|
2101
|
+
this.title = (_a = this.data) === null || _a === void 0 ? void 0 : _a[RouteTitleKey];
|
|
2076
2102
|
this.routeConfig = routeConfig;
|
|
2077
2103
|
this._urlSegment = urlSegment;
|
|
2078
2104
|
this._lastPathIndex = lastPathIndex;
|
|
@@ -2362,9 +2388,9 @@ class ChildrenOutletContexts {
|
|
|
2362
2388
|
return this.contexts.get(childName) || null;
|
|
2363
2389
|
}
|
|
2364
2390
|
}
|
|
2365
|
-
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
2366
|
-
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
2367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
2391
|
+
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2392
|
+
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
|
|
2393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
2368
2394
|
type: Injectable,
|
|
2369
2395
|
args: [{ providedIn: 'root' }]
|
|
2370
2396
|
}] });
|
|
@@ -2376,7 +2402,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2376
2402
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2377
2403
|
* found in the LICENSE file at https://angular.io/license
|
|
2378
2404
|
*/
|
|
2379
|
-
const NG_DEV_MODE$
|
|
2405
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2380
2406
|
/**
|
|
2381
2407
|
* @description
|
|
2382
2408
|
*
|
|
@@ -2486,12 +2512,12 @@ class RouterOutlet {
|
|
|
2486
2512
|
*/
|
|
2487
2513
|
get component() {
|
|
2488
2514
|
if (!this.activated)
|
|
2489
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2515
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2490
2516
|
return this.activated.instance;
|
|
2491
2517
|
}
|
|
2492
2518
|
get activatedRoute() {
|
|
2493
2519
|
if (!this.activated)
|
|
2494
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2520
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2495
2521
|
return this._activatedRoute;
|
|
2496
2522
|
}
|
|
2497
2523
|
get activatedRouteData() {
|
|
@@ -2505,7 +2531,7 @@ class RouterOutlet {
|
|
|
2505
2531
|
*/
|
|
2506
2532
|
detach() {
|
|
2507
2533
|
if (!this.activated)
|
|
2508
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2534
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2509
2535
|
this.location.detach();
|
|
2510
2536
|
const cmp = this.activated;
|
|
2511
2537
|
this.activated = null;
|
|
@@ -2533,7 +2559,7 @@ class RouterOutlet {
|
|
|
2533
2559
|
}
|
|
2534
2560
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2535
2561
|
if (this.isActivated) {
|
|
2536
|
-
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$
|
|
2562
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
|
|
2537
2563
|
}
|
|
2538
2564
|
this._activatedRoute = activatedRoute;
|
|
2539
2565
|
const location = this.location;
|
|
@@ -2555,11 +2581,15 @@ class RouterOutlet {
|
|
|
2555
2581
|
this.activateEvents.emit(this.activated.instance);
|
|
2556
2582
|
}
|
|
2557
2583
|
}
|
|
2558
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
2559
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
2560
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
2584
|
+
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 });
|
|
2585
|
+
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 });
|
|
2586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2561
2587
|
type: Directive,
|
|
2562
|
-
args: [{
|
|
2588
|
+
args: [{
|
|
2589
|
+
selector: 'router-outlet',
|
|
2590
|
+
exportAs: 'outlet',
|
|
2591
|
+
standalone: true,
|
|
2592
|
+
}]
|
|
2563
2593
|
}], ctorParameters: function () {
|
|
2564
2594
|
return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
2565
2595
|
type: Attribute,
|
|
@@ -2616,11 +2646,15 @@ function isComponentFactoryResolver(item) {
|
|
|
2616
2646
|
*/
|
|
2617
2647
|
class ɵEmptyOutletComponent {
|
|
2618
2648
|
}
|
|
2619
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
2620
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.
|
|
2621
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
2649
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2650
|
+
ɵ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"] }] });
|
|
2651
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2622
2652
|
type: Component,
|
|
2623
|
-
args: [{
|
|
2653
|
+
args: [{
|
|
2654
|
+
template: `<router-outlet></router-outlet>`,
|
|
2655
|
+
imports: [RouterOutlet],
|
|
2656
|
+
standalone: true,
|
|
2657
|
+
}]
|
|
2624
2658
|
}] });
|
|
2625
2659
|
|
|
2626
2660
|
/**
|
|
@@ -3021,10 +3055,20 @@ function getCanActivateChild(p) {
|
|
|
3021
3055
|
return null;
|
|
3022
3056
|
return { node: p, guards: canActivateChild };
|
|
3023
3057
|
}
|
|
3024
|
-
function
|
|
3025
|
-
const
|
|
3026
|
-
const
|
|
3027
|
-
|
|
3058
|
+
function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
|
|
3059
|
+
const NOT_FOUND = Symbol();
|
|
3060
|
+
const result = injector.get(tokenOrFunction, NOT_FOUND);
|
|
3061
|
+
if (result === NOT_FOUND) {
|
|
3062
|
+
if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {
|
|
3063
|
+
// We think the token is just a function so return it as-is
|
|
3064
|
+
return tokenOrFunction;
|
|
3065
|
+
}
|
|
3066
|
+
else {
|
|
3067
|
+
// This will throw the not found error
|
|
3068
|
+
return injector.get(tokenOrFunction);
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
return result;
|
|
3028
3072
|
}
|
|
3029
3073
|
function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
|
|
3030
3074
|
canDeactivateChecks: [],
|
|
@@ -3223,28 +3267,28 @@ function prioritizedGuardValue() {
|
|
|
3223
3267
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3224
3268
|
* found in the LICENSE file at https://angular.io/license
|
|
3225
3269
|
*/
|
|
3226
|
-
function checkGuards(
|
|
3270
|
+
function checkGuards(injector, forwardEvent) {
|
|
3227
3271
|
return mergeMap(t => {
|
|
3228
3272
|
const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
|
|
3229
3273
|
if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
|
|
3230
3274
|
return of(Object.assign(Object.assign({}, t), { guardsResult: true }));
|
|
3231
3275
|
}
|
|
3232
|
-
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot,
|
|
3276
|
+
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector)
|
|
3233
3277
|
.pipe(mergeMap(canDeactivate => {
|
|
3234
3278
|
return canDeactivate && isBoolean(canDeactivate) ?
|
|
3235
|
-
runCanActivateChecks(targetSnapshot, canActivateChecks,
|
|
3279
|
+
runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) :
|
|
3236
3280
|
of(canDeactivate);
|
|
3237
3281
|
}), map(guardsResult => (Object.assign(Object.assign({}, t), { guardsResult }))));
|
|
3238
3282
|
});
|
|
3239
3283
|
}
|
|
3240
|
-
function runCanDeactivateChecks(checks, futureRSS, currRSS,
|
|
3241
|
-
return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS,
|
|
3284
|
+
function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
|
|
3285
|
+
return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {
|
|
3242
3286
|
return result !== true;
|
|
3243
3287
|
}, true));
|
|
3244
3288
|
}
|
|
3245
|
-
function runCanActivateChecks(futureSnapshot, checks,
|
|
3289
|
+
function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
|
|
3246
3290
|
return from(checks).pipe(concatMap((check) => {
|
|
3247
|
-
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path,
|
|
3291
|
+
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
|
|
3248
3292
|
}), first(result => {
|
|
3249
3293
|
return result !== true;
|
|
3250
3294
|
}, true));
|
|
@@ -3277,21 +3321,24 @@ function fireChildActivationStart(snapshot, forwardEvent) {
|
|
|
3277
3321
|
}
|
|
3278
3322
|
return of(true);
|
|
3279
3323
|
}
|
|
3280
|
-
function runCanActivate(futureRSS, futureARS,
|
|
3324
|
+
function runCanActivate(futureRSS, futureARS, injector) {
|
|
3281
3325
|
const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
|
|
3282
3326
|
if (!canActivate || canActivate.length === 0)
|
|
3283
3327
|
return of(true);
|
|
3284
|
-
const canActivateObservables = canActivate.map((
|
|
3328
|
+
const canActivateObservables = canActivate.map((canActivate) => {
|
|
3285
3329
|
return defer(() => {
|
|
3286
|
-
|
|
3287
|
-
const
|
|
3288
|
-
|
|
3330
|
+
var _a;
|
|
3331
|
+
const closestInjector = (_a = getClosestRouteInjector(futureARS)) !== null && _a !== void 0 ? _a : injector;
|
|
3332
|
+
const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
|
|
3333
|
+
const guardVal = isCanActivate(guard) ?
|
|
3334
|
+
guard.canActivate(futureARS, futureRSS) :
|
|
3335
|
+
closestInjector.runInContext(() => guard(futureARS, futureRSS));
|
|
3289
3336
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3290
3337
|
});
|
|
3291
3338
|
});
|
|
3292
3339
|
return of(canActivateObservables).pipe(prioritizedGuardValue());
|
|
3293
3340
|
}
|
|
3294
|
-
function runCanActivateChild(futureRSS, path,
|
|
3341
|
+
function runCanActivateChild(futureRSS, path, injector) {
|
|
3295
3342
|
const futureARS = path[path.length - 1];
|
|
3296
3343
|
const canActivateChildGuards = path.slice(0, path.length - 1)
|
|
3297
3344
|
.reverse()
|
|
@@ -3299,10 +3346,13 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3299
3346
|
.filter(_ => _ !== null);
|
|
3300
3347
|
const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
|
|
3301
3348
|
return defer(() => {
|
|
3302
|
-
const guardsMapped = d.guards.map((
|
|
3303
|
-
|
|
3304
|
-
const
|
|
3305
|
-
|
|
3349
|
+
const guardsMapped = d.guards.map((canActivateChild) => {
|
|
3350
|
+
var _a;
|
|
3351
|
+
const closestInjector = (_a = getClosestRouteInjector(d.node)) !== null && _a !== void 0 ? _a : injector;
|
|
3352
|
+
const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
|
|
3353
|
+
const guardVal = isCanActivateChild(guard) ?
|
|
3354
|
+
guard.canActivateChild(futureARS, futureRSS) :
|
|
3355
|
+
closestInjector.runInContext(() => guard(futureARS, futureRSS));
|
|
3306
3356
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3307
3357
|
});
|
|
3308
3358
|
return of(guardsMapped).pipe(prioritizedGuardValue());
|
|
@@ -3310,15 +3360,17 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3310
3360
|
});
|
|
3311
3361
|
return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
|
|
3312
3362
|
}
|
|
3313
|
-
function runCanDeactivate(component, currARS, currRSS, futureRSS,
|
|
3363
|
+
function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
|
|
3314
3364
|
const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
|
|
3315
3365
|
if (!canDeactivate || canDeactivate.length === 0)
|
|
3316
3366
|
return of(true);
|
|
3317
3367
|
const canDeactivateObservables = canDeactivate.map((c) => {
|
|
3318
|
-
|
|
3368
|
+
var _a;
|
|
3369
|
+
const closestInjector = (_a = getClosestRouteInjector(currARS)) !== null && _a !== void 0 ? _a : injector;
|
|
3370
|
+
const guard = getTokenOrFunctionIdentity(c, closestInjector);
|
|
3319
3371
|
const guardVal = isCanDeactivate(guard) ?
|
|
3320
3372
|
guard.canDeactivate(component, currARS, currRSS, futureRSS) :
|
|
3321
|
-
guard(component, currARS, currRSS, futureRSS);
|
|
3373
|
+
closestInjector.runInContext(() => guard(component, currARS, currRSS, futureRSS));
|
|
3322
3374
|
return wrapIntoObservable(guardVal).pipe(first());
|
|
3323
3375
|
});
|
|
3324
3376
|
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
|
@@ -3329,8 +3381,10 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
|
|
|
3329
3381
|
return of(true);
|
|
3330
3382
|
}
|
|
3331
3383
|
const canLoadObservables = canLoad.map((injectionToken) => {
|
|
3332
|
-
const guard =
|
|
3333
|
-
const guardVal = isCanLoad(guard) ?
|
|
3384
|
+
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
|
|
3385
|
+
const guardVal = isCanLoad(guard) ?
|
|
3386
|
+
guard.canLoad(route, segments) :
|
|
3387
|
+
injector.runInContext(() => guard(route, segments));
|
|
3334
3388
|
return wrapIntoObservable(guardVal);
|
|
3335
3389
|
});
|
|
3336
3390
|
return of(canLoadObservables)
|
|
@@ -3348,8 +3402,10 @@ function runCanMatchGuards(injector, route, segments, urlSerializer) {
|
|
|
3348
3402
|
if (!canMatch || canMatch.length === 0)
|
|
3349
3403
|
return of(true);
|
|
3350
3404
|
const canMatchObservables = canMatch.map(injectionToken => {
|
|
3351
|
-
const guard =
|
|
3352
|
-
const guardVal = isCanMatch(guard) ?
|
|
3405
|
+
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
|
|
3406
|
+
const guardVal = isCanMatch(guard) ?
|
|
3407
|
+
guard.canMatch(route, segments) :
|
|
3408
|
+
injector.runInContext(() => guard(route, segments));
|
|
3353
3409
|
return wrapIntoObservable(guardVal);
|
|
3354
3410
|
});
|
|
3355
3411
|
return of(canMatchObservables)
|
|
@@ -3518,7 +3574,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3518
3574
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3519
3575
|
* found in the LICENSE file at https://angular.io/license
|
|
3520
3576
|
*/
|
|
3521
|
-
const NG_DEV_MODE$
|
|
3577
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3522
3578
|
class NoMatch$1 {
|
|
3523
3579
|
constructor(segmentGroup) {
|
|
3524
3580
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3536,11 +3592,11 @@ function absoluteRedirect(newTree) {
|
|
|
3536
3592
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3537
3593
|
}
|
|
3538
3594
|
function namedOutletsRedirect(redirectTo) {
|
|
3539
|
-
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$
|
|
3595
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3540
3596
|
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3541
3597
|
}
|
|
3542
3598
|
function canLoadFails(route) {
|
|
3543
|
-
return throwError(navigationCancelingError(NG_DEV_MODE$
|
|
3599
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
|
|
3544
3600
|
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3545
3601
|
}
|
|
3546
3602
|
/**
|
|
@@ -3600,7 +3656,7 @@ class ApplyRedirects {
|
|
|
3600
3656
|
}));
|
|
3601
3657
|
}
|
|
3602
3658
|
noMatchError(e) {
|
|
3603
|
-
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$
|
|
3659
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3604
3660
|
}
|
|
3605
3661
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3606
3662
|
const root = createRoot(rootCandidate);
|
|
@@ -3817,7 +3873,7 @@ class ApplyRedirects {
|
|
|
3817
3873
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3818
3874
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3819
3875
|
if (!pos)
|
|
3820
|
-
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$
|
|
3876
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3821
3877
|
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3822
3878
|
return pos;
|
|
3823
3879
|
}
|
|
@@ -3853,7 +3909,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
|
|
|
3853
3909
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3854
3910
|
* found in the LICENSE file at https://angular.io/license
|
|
3855
3911
|
*/
|
|
3856
|
-
const NG_DEV_MODE$
|
|
3912
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3857
3913
|
class NoMatch {
|
|
3858
3914
|
}
|
|
3859
3915
|
function newObservableError(e) {
|
|
@@ -3942,7 +3998,7 @@ class Recognizer {
|
|
|
3942
3998
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3943
3999
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3944
4000
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3945
|
-
if (NG_DEV_MODE$
|
|
4001
|
+
if (NG_DEV_MODE$5) {
|
|
3946
4002
|
// This should really never happen - we are only taking the first match for each
|
|
3947
4003
|
// outlet and merge the empty path matches.
|
|
3948
4004
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -3977,7 +4033,7 @@ class Recognizer {
|
|
|
3977
4033
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3978
4034
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3979
4035
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3980
|
-
(NG_DEV_MODE$
|
|
4036
|
+
(NG_DEV_MODE$5 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3981
4037
|
pathIndexShift));
|
|
3982
4038
|
matchResult = of({
|
|
3983
4039
|
snapshot,
|
|
@@ -3994,7 +4050,7 @@ class Recognizer {
|
|
|
3994
4050
|
return null;
|
|
3995
4051
|
}
|
|
3996
4052
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
3997
|
-
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$
|
|
4053
|
+
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$5 ?
|
|
3998
4054
|
getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3999
4055
|
pathIndexShift));
|
|
4000
4056
|
return { snapshot, consumedSegments, remainingSegments };
|
|
@@ -4108,7 +4164,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4108
4164
|
if (routeWithSameOutletName) {
|
|
4109
4165
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4110
4166
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4111
|
-
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$
|
|
4167
|
+
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}'.`);
|
|
4112
4168
|
}
|
|
4113
4169
|
names[n.value.outlet] = n.value;
|
|
4114
4170
|
});
|
|
@@ -4166,13 +4222,7 @@ function recognize(injector, rootComponentType, config, serializer, paramsInheri
|
|
|
4166
4222
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4167
4223
|
* found in the LICENSE file at https://angular.io/license
|
|
4168
4224
|
*/
|
|
4169
|
-
|
|
4170
|
-
* A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
|
|
4171
|
-
* static string or `Route.resolve` if anything else. This allows us to reuse the existing route
|
|
4172
|
-
* data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
|
|
4173
|
-
*/
|
|
4174
|
-
const RouteTitle = Symbol('RouteTitle');
|
|
4175
|
-
function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
4225
|
+
function resolveData(paramsInheritanceStrategy, injector) {
|
|
4176
4226
|
return mergeMap(t => {
|
|
4177
4227
|
const { targetSnapshot, guards: { canActivateChecks } } = t;
|
|
4178
4228
|
if (!canActivateChecks.length) {
|
|
@@ -4180,32 +4230,31 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
|
|
4180
4230
|
}
|
|
4181
4231
|
let canActivateChecksResolved = 0;
|
|
4182
4232
|
return from(canActivateChecks)
|
|
4183
|
-
.pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy,
|
|
4233
|
+
.pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, injector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
|
|
4184
4234
|
});
|
|
4185
4235
|
}
|
|
4186
|
-
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy,
|
|
4236
|
+
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
|
|
4187
4237
|
const config = futureARS.routeConfig;
|
|
4188
4238
|
const resolve = futureARS._resolve;
|
|
4189
4239
|
if ((config === null || config === void 0 ? void 0 : config.title) !== undefined && !hasStaticTitle(config)) {
|
|
4190
|
-
resolve[
|
|
4240
|
+
resolve[RouteTitleKey] = config.title;
|
|
4191
4241
|
}
|
|
4192
|
-
return resolveNode(resolve, futureARS, futureRSS,
|
|
4193
|
-
.pipe(map((resolvedData) => {
|
|
4242
|
+
return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => {
|
|
4194
4243
|
futureARS._resolvedData = resolvedData;
|
|
4195
4244
|
futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve;
|
|
4196
4245
|
if (config && hasStaticTitle(config)) {
|
|
4197
|
-
futureARS.data[
|
|
4246
|
+
futureARS.data[RouteTitleKey] = config.title;
|
|
4198
4247
|
}
|
|
4199
4248
|
return null;
|
|
4200
4249
|
}));
|
|
4201
4250
|
}
|
|
4202
|
-
function resolveNode(resolve, futureARS, futureRSS,
|
|
4251
|
+
function resolveNode(resolve, futureARS, futureRSS, injector) {
|
|
4203
4252
|
const keys = getDataKeys(resolve);
|
|
4204
4253
|
if (keys.length === 0) {
|
|
4205
4254
|
return of({});
|
|
4206
4255
|
}
|
|
4207
4256
|
const data = {};
|
|
4208
|
-
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS,
|
|
4257
|
+
return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector)
|
|
4209
4258
|
.pipe(first(), tap((value) => {
|
|
4210
4259
|
data[key] = value;
|
|
4211
4260
|
}))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
|
|
@@ -4213,10 +4262,14 @@ function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
|
|
|
4213
4262
|
function getDataKeys(obj) {
|
|
4214
4263
|
return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
|
|
4215
4264
|
}
|
|
4216
|
-
function getResolver(injectionToken, futureARS, futureRSS,
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4265
|
+
function getResolver(injectionToken, futureARS, futureRSS, injector) {
|
|
4266
|
+
var _a;
|
|
4267
|
+
const closestInjector = (_a = getClosestRouteInjector(futureARS)) !== null && _a !== void 0 ? _a : injector;
|
|
4268
|
+
const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
|
|
4269
|
+
const resolverValue = resolver.resolve ?
|
|
4270
|
+
resolver.resolve(futureARS, futureRSS) :
|
|
4271
|
+
closestInjector.runInContext(() => resolver(futureARS, futureRSS));
|
|
4272
|
+
return wrapIntoObservable(resolverValue);
|
|
4220
4273
|
}
|
|
4221
4274
|
function hasStaticTitle(config) {
|
|
4222
4275
|
return typeof config.title === 'string' || config.title === null;
|
|
@@ -4294,12 +4347,12 @@ class TitleStrategy {
|
|
|
4294
4347
|
* `Route.title` property, which can either be a static string or a resolved value.
|
|
4295
4348
|
*/
|
|
4296
4349
|
getResolvedTitleForRoute(snapshot) {
|
|
4297
|
-
return snapshot.data[
|
|
4350
|
+
return snapshot.data[RouteTitleKey];
|
|
4298
4351
|
}
|
|
4299
4352
|
}
|
|
4300
|
-
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
4301
|
-
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
4302
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
4353
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4354
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4303
4356
|
type: Injectable,
|
|
4304
4357
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4305
4358
|
}] });
|
|
@@ -4323,9 +4376,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
4323
4376
|
}
|
|
4324
4377
|
}
|
|
4325
4378
|
}
|
|
4326
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
4327
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
4328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
4379
|
+
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 });
|
|
4380
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4381
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4329
4382
|
type: Injectable,
|
|
4330
4383
|
args: [{ providedIn: 'root' }]
|
|
4331
4384
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -4414,13 +4467,13 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4414
4467
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4415
4468
|
* found in the LICENSE file at https://angular.io/license
|
|
4416
4469
|
*/
|
|
4417
|
-
const NG_DEV_MODE$
|
|
4470
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4418
4471
|
/**
|
|
4419
4472
|
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
4420
4473
|
*
|
|
4421
4474
|
* @publicApi
|
|
4422
4475
|
*/
|
|
4423
|
-
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$
|
|
4476
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
|
|
4424
4477
|
providedIn: 'root',
|
|
4425
4478
|
factory: () => ({}),
|
|
4426
4479
|
});
|
|
@@ -4432,7 +4485,7 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config'
|
|
|
4432
4485
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4433
4486
|
* found in the LICENSE file at https://angular.io/license
|
|
4434
4487
|
*/
|
|
4435
|
-
const NG_DEV_MODE$
|
|
4488
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4436
4489
|
/**
|
|
4437
4490
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4438
4491
|
*
|
|
@@ -4467,7 +4520,7 @@ class RouterConfigLoader {
|
|
|
4467
4520
|
if (this.onLoadEndListener) {
|
|
4468
4521
|
this.onLoadEndListener(route);
|
|
4469
4522
|
}
|
|
4470
|
-
NG_DEV_MODE$
|
|
4523
|
+
NG_DEV_MODE$3 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
|
|
4471
4524
|
route._loadedComponent = component;
|
|
4472
4525
|
}), finalize(() => {
|
|
4473
4526
|
this.componentLoaders.delete(route);
|
|
@@ -4510,7 +4563,7 @@ class RouterConfigLoader {
|
|
|
4510
4563
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4511
4564
|
}
|
|
4512
4565
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4513
|
-
NG_DEV_MODE$
|
|
4566
|
+
NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4514
4567
|
return { routes, injector };
|
|
4515
4568
|
}), finalize(() => {
|
|
4516
4569
|
this.childrenLoaders.delete(route);
|
|
@@ -4532,9 +4585,9 @@ class RouterConfigLoader {
|
|
|
4532
4585
|
}));
|
|
4533
4586
|
}
|
|
4534
4587
|
}
|
|
4535
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
4536
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
4537
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
4588
|
+
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 });
|
|
4589
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4538
4591
|
type: Injectable,
|
|
4539
4592
|
args: [{ providedIn: 'root' }]
|
|
4540
4593
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
@@ -4577,7 +4630,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4577
4630
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4578
4631
|
* found in the LICENSE file at https://angular.io/license
|
|
4579
4632
|
*/
|
|
4580
|
-
const NG_DEV_MODE$
|
|
4633
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4581
4634
|
function defaultErrorHandler(error) {
|
|
4582
4635
|
throw error;
|
|
4583
4636
|
}
|
|
@@ -4972,7 +5025,7 @@ class Router {
|
|
|
4972
5025
|
complete: () => {
|
|
4973
5026
|
if (!dataResolved) {
|
|
4974
5027
|
this.restoreHistory(t);
|
|
4975
|
-
this.cancelNavigationTransition(t, NG_DEV_MODE$
|
|
5028
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
|
|
4976
5029
|
`At least one route resolver didn't emit any value.` :
|
|
4977
5030
|
'', 2 /* NavigationCancellationCode.NoDataFromResolver */);
|
|
4978
5031
|
}
|
|
@@ -5041,7 +5094,7 @@ class Router {
|
|
|
5041
5094
|
* catch-all to make sure the NavigationCancel event is fired when a
|
|
5042
5095
|
* navigation gets cancelled but not caught by other means. */
|
|
5043
5096
|
if (!completed && !errored) {
|
|
5044
|
-
const cancelationReason = NG_DEV_MODE$
|
|
5097
|
+
const cancelationReason = NG_DEV_MODE$2 ?
|
|
5045
5098
|
`Navigation ID ${overallTransitionState
|
|
5046
5099
|
.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
5047
5100
|
'';
|
|
@@ -5201,7 +5254,7 @@ class Router {
|
|
|
5201
5254
|
* ```
|
|
5202
5255
|
*/
|
|
5203
5256
|
resetConfig(config) {
|
|
5204
|
-
NG_DEV_MODE$
|
|
5257
|
+
NG_DEV_MODE$2 && validateConfig(config);
|
|
5205
5258
|
this.config = config.map(standardizeConfig);
|
|
5206
5259
|
this.navigated = false;
|
|
5207
5260
|
this.lastSuccessfulId = -1;
|
|
@@ -5559,9 +5612,9 @@ class Router {
|
|
|
5559
5612
|
return { navigationId };
|
|
5560
5613
|
}
|
|
5561
5614
|
}
|
|
5562
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
5563
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
5564
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
5615
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5616
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
|
|
5617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: Router, decorators: [{
|
|
5565
5618
|
type: Injectable,
|
|
5566
5619
|
args: [{
|
|
5567
5620
|
providedIn: 'root',
|
|
@@ -5572,7 +5625,7 @@ function validateCommands(commands) {
|
|
|
5572
5625
|
for (let i = 0; i < commands.length; i++) {
|
|
5573
5626
|
const cmd = commands[i];
|
|
5574
5627
|
if (cmd == null) {
|
|
5575
|
-
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$
|
|
5628
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$2 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5576
5629
|
}
|
|
5577
5630
|
}
|
|
5578
5631
|
}
|
|
@@ -5684,11 +5737,50 @@ class RouterLink {
|
|
|
5684
5737
|
this.tabIndexAttribute = tabIndexAttribute;
|
|
5685
5738
|
this.renderer = renderer;
|
|
5686
5739
|
this.el = el;
|
|
5740
|
+
this._preserveFragment = false;
|
|
5741
|
+
this._skipLocationChange = false;
|
|
5742
|
+
this._replaceUrl = false;
|
|
5687
5743
|
this.commands = null;
|
|
5688
5744
|
/** @internal */
|
|
5689
5745
|
this.onChanges = new Subject();
|
|
5690
5746
|
this.setTabIndexIfNotOnNativeEl('0');
|
|
5691
5747
|
}
|
|
5748
|
+
/**
|
|
5749
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5750
|
+
* `UrlCreationOptions`.
|
|
5751
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5752
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5753
|
+
*/
|
|
5754
|
+
set preserveFragment(preserveFragment) {
|
|
5755
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5756
|
+
}
|
|
5757
|
+
get preserveFragment() {
|
|
5758
|
+
return this._preserveFragment;
|
|
5759
|
+
}
|
|
5760
|
+
/**
|
|
5761
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5762
|
+
* `NavigationBehaviorOptions`.
|
|
5763
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5764
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5765
|
+
*/
|
|
5766
|
+
set skipLocationChange(skipLocationChange) {
|
|
5767
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5768
|
+
}
|
|
5769
|
+
get skipLocationChange() {
|
|
5770
|
+
return this._skipLocationChange;
|
|
5771
|
+
}
|
|
5772
|
+
/**
|
|
5773
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5774
|
+
* `NavigationBehaviorOptions`.
|
|
5775
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5776
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5777
|
+
*/
|
|
5778
|
+
set replaceUrl(replaceUrl) {
|
|
5779
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5780
|
+
}
|
|
5781
|
+
get replaceUrl() {
|
|
5782
|
+
return this._replaceUrl;
|
|
5783
|
+
}
|
|
5692
5784
|
/**
|
|
5693
5785
|
* Modifies the tab index if there was not a tabindex attribute on the element during
|
|
5694
5786
|
* instantiation.
|
|
@@ -5735,8 +5827,8 @@ class RouterLink {
|
|
|
5735
5827
|
return true;
|
|
5736
5828
|
}
|
|
5737
5829
|
const extras = {
|
|
5738
|
-
skipLocationChange:
|
|
5739
|
-
replaceUrl:
|
|
5830
|
+
skipLocationChange: this.skipLocationChange,
|
|
5831
|
+
replaceUrl: this.replaceUrl,
|
|
5740
5832
|
state: this.state,
|
|
5741
5833
|
};
|
|
5742
5834
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5753,15 +5845,18 @@ class RouterLink {
|
|
|
5753
5845
|
queryParams: this.queryParams,
|
|
5754
5846
|
fragment: this.fragment,
|
|
5755
5847
|
queryParamsHandling: this.queryParamsHandling,
|
|
5756
|
-
preserveFragment:
|
|
5848
|
+
preserveFragment: this.preserveFragment,
|
|
5757
5849
|
});
|
|
5758
5850
|
}
|
|
5759
5851
|
}
|
|
5760
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
5761
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
5762
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
5852
|
+
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 });
|
|
5853
|
+
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 });
|
|
5854
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLink, decorators: [{
|
|
5763
5855
|
type: Directive,
|
|
5764
|
-
args: [{
|
|
5856
|
+
args: [{
|
|
5857
|
+
selector: ':not(a):not(area)[routerLink]',
|
|
5858
|
+
standalone: true,
|
|
5859
|
+
}]
|
|
5765
5860
|
}], ctorParameters: function () {
|
|
5766
5861
|
return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
5767
5862
|
type: Attribute,
|
|
@@ -5773,16 +5868,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
5773
5868
|
type: Input
|
|
5774
5869
|
}], queryParamsHandling: [{
|
|
5775
5870
|
type: Input
|
|
5871
|
+
}], state: [{
|
|
5872
|
+
type: Input
|
|
5873
|
+
}], relativeTo: [{
|
|
5874
|
+
type: Input
|
|
5776
5875
|
}], preserveFragment: [{
|
|
5777
5876
|
type: Input
|
|
5778
5877
|
}], skipLocationChange: [{
|
|
5779
5878
|
type: Input
|
|
5780
5879
|
}], replaceUrl: [{
|
|
5781
5880
|
type: Input
|
|
5782
|
-
}], state: [{
|
|
5783
|
-
type: Input
|
|
5784
|
-
}], relativeTo: [{
|
|
5785
|
-
type: Input
|
|
5786
5881
|
}], routerLink: [{
|
|
5787
5882
|
type: Input
|
|
5788
5883
|
}], onClick: [{
|
|
@@ -5805,6 +5900,9 @@ class RouterLinkWithHref {
|
|
|
5805
5900
|
this.router = router;
|
|
5806
5901
|
this.route = route;
|
|
5807
5902
|
this.locationStrategy = locationStrategy;
|
|
5903
|
+
this._preserveFragment = false;
|
|
5904
|
+
this._skipLocationChange = false;
|
|
5905
|
+
this._replaceUrl = false;
|
|
5808
5906
|
this.commands = null;
|
|
5809
5907
|
// the url displayed on the anchor element.
|
|
5810
5908
|
// @HostBinding('attr.href') is used rather than @HostBinding() because it removes the
|
|
@@ -5818,6 +5916,42 @@ class RouterLinkWithHref {
|
|
|
5818
5916
|
}
|
|
5819
5917
|
});
|
|
5820
5918
|
}
|
|
5919
|
+
/**
|
|
5920
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5921
|
+
* `UrlCreationOptions`.
|
|
5922
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5923
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5924
|
+
*/
|
|
5925
|
+
set preserveFragment(preserveFragment) {
|
|
5926
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5927
|
+
}
|
|
5928
|
+
get preserveFragment() {
|
|
5929
|
+
return this._preserveFragment;
|
|
5930
|
+
}
|
|
5931
|
+
/**
|
|
5932
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5933
|
+
* `NavigationBehaviorOptions`.
|
|
5934
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5935
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5936
|
+
*/
|
|
5937
|
+
set skipLocationChange(skipLocationChange) {
|
|
5938
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5939
|
+
}
|
|
5940
|
+
get skipLocationChange() {
|
|
5941
|
+
return this._skipLocationChange;
|
|
5942
|
+
}
|
|
5943
|
+
/**
|
|
5944
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5945
|
+
* `NavigationBehaviorOptions`.
|
|
5946
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5947
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5948
|
+
*/
|
|
5949
|
+
set replaceUrl(replaceUrl) {
|
|
5950
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5951
|
+
}
|
|
5952
|
+
get replaceUrl() {
|
|
5953
|
+
return this._replaceUrl;
|
|
5954
|
+
}
|
|
5821
5955
|
/**
|
|
5822
5956
|
* Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
5823
5957
|
* - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
@@ -5851,8 +5985,8 @@ class RouterLinkWithHref {
|
|
|
5851
5985
|
return true;
|
|
5852
5986
|
}
|
|
5853
5987
|
const extras = {
|
|
5854
|
-
skipLocationChange:
|
|
5855
|
-
replaceUrl:
|
|
5988
|
+
skipLocationChange: this.skipLocationChange,
|
|
5989
|
+
replaceUrl: this.replaceUrl,
|
|
5856
5990
|
state: this.state
|
|
5857
5991
|
};
|
|
5858
5992
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5874,15 +6008,15 @@ class RouterLinkWithHref {
|
|
|
5874
6008
|
queryParams: this.queryParams,
|
|
5875
6009
|
fragment: this.fragment,
|
|
5876
6010
|
queryParamsHandling: this.queryParamsHandling,
|
|
5877
|
-
preserveFragment:
|
|
6011
|
+
preserveFragment: this.preserveFragment,
|
|
5878
6012
|
});
|
|
5879
6013
|
}
|
|
5880
6014
|
}
|
|
5881
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
5882
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
5883
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6015
|
+
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 });
|
|
6016
|
+
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 });
|
|
6017
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5884
6018
|
type: Directive,
|
|
5885
|
-
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
6019
|
+
args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
|
|
5886
6020
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
5887
6021
|
type: HostBinding,
|
|
5888
6022
|
args: ['attr.target']
|
|
@@ -5894,12 +6028,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
5894
6028
|
type: Input
|
|
5895
6029
|
}], queryParamsHandling: [{
|
|
5896
6030
|
type: Input
|
|
5897
|
-
}], preserveFragment: [{
|
|
5898
|
-
type: Input
|
|
5899
|
-
}], skipLocationChange: [{
|
|
5900
|
-
type: Input
|
|
5901
|
-
}], replaceUrl: [{
|
|
5902
|
-
type: Input
|
|
5903
6031
|
}], state: [{
|
|
5904
6032
|
type: Input
|
|
5905
6033
|
}], relativeTo: [{
|
|
@@ -5907,6 +6035,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
5907
6035
|
}], href: [{
|
|
5908
6036
|
type: HostBinding,
|
|
5909
6037
|
args: ['attr.href']
|
|
6038
|
+
}], preserveFragment: [{
|
|
6039
|
+
type: Input
|
|
6040
|
+
}], skipLocationChange: [{
|
|
6041
|
+
type: Input
|
|
6042
|
+
}], replaceUrl: [{
|
|
6043
|
+
type: Input
|
|
5910
6044
|
}], routerLink: [{
|
|
5911
6045
|
type: Input
|
|
5912
6046
|
}], onClick: [{
|
|
@@ -6107,13 +6241,14 @@ class RouterLinkActive {
|
|
|
6107
6241
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
6108
6242
|
}
|
|
6109
6243
|
}
|
|
6110
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6111
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
6112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6244
|
+
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 });
|
|
6245
|
+
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 });
|
|
6246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
6113
6247
|
type: Directive,
|
|
6114
6248
|
args: [{
|
|
6115
6249
|
selector: '[routerLinkActive]',
|
|
6116
6250
|
exportAs: 'routerLinkActive',
|
|
6251
|
+
standalone: true,
|
|
6117
6252
|
}]
|
|
6118
6253
|
}], ctorParameters: function () {
|
|
6119
6254
|
return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
|
|
@@ -6175,9 +6310,9 @@ class PreloadAllModules {
|
|
|
6175
6310
|
return fn().pipe(catchError(() => of(null)));
|
|
6176
6311
|
}
|
|
6177
6312
|
}
|
|
6178
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6179
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6180
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6313
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6314
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6181
6316
|
type: Injectable,
|
|
6182
6317
|
args: [{ providedIn: 'root' }]
|
|
6183
6318
|
}] });
|
|
@@ -6195,9 +6330,9 @@ class NoPreloading {
|
|
|
6195
6330
|
return of(null);
|
|
6196
6331
|
}
|
|
6197
6332
|
}
|
|
6198
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6199
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6200
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6333
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6334
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6201
6336
|
type: Injectable,
|
|
6202
6337
|
args: [{ providedIn: 'root' }]
|
|
6203
6338
|
}] });
|
|
@@ -6293,10 +6428,11 @@ class RouterPreloader {
|
|
|
6293
6428
|
});
|
|
6294
6429
|
}
|
|
6295
6430
|
}
|
|
6296
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6297
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6298
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6299
|
-
type: Injectable
|
|
6431
|
+
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 });
|
|
6432
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
|
|
6433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6434
|
+
type: Injectable,
|
|
6435
|
+
args: [{ providedIn: 'root' }]
|
|
6300
6436
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6301
6437
|
|
|
6302
6438
|
const ROUTER_SCROLLER = new InjectionToken('');
|
|
@@ -6375,12 +6511,423 @@ class RouterScroller {
|
|
|
6375
6511
|
}
|
|
6376
6512
|
}
|
|
6377
6513
|
}
|
|
6378
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6379
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.
|
|
6380
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
6514
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6515
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterScroller });
|
|
6516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6381
6517
|
type: Injectable
|
|
6382
6518
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6383
6519
|
|
|
6520
|
+
/**
|
|
6521
|
+
* @license
|
|
6522
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6523
|
+
*
|
|
6524
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6525
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6526
|
+
*/
|
|
6527
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6528
|
+
/**
|
|
6529
|
+
* Sets up providers necessary to enable `Router` functionality for the application.
|
|
6530
|
+
* Allows to configure a set of routes as well as extra features that should be enabled.
|
|
6531
|
+
*
|
|
6532
|
+
* @usageNotes
|
|
6533
|
+
*
|
|
6534
|
+
* Basic example of how you can add a Router to your application:
|
|
6535
|
+
* ```
|
|
6536
|
+
* const appRoutes: Routes = [];
|
|
6537
|
+
* bootstrapApplication(AppComponent, {
|
|
6538
|
+
* providers: [provideRouter(appRoutes)]
|
|
6539
|
+
* });
|
|
6540
|
+
* ```
|
|
6541
|
+
*
|
|
6542
|
+
* You can also enable optional features in the Router by adding functions from the `RouterFeatures`
|
|
6543
|
+
* type:
|
|
6544
|
+
* ```
|
|
6545
|
+
* const appRoutes: Routes = [];
|
|
6546
|
+
* bootstrapApplication(AppComponent,
|
|
6547
|
+
* {
|
|
6548
|
+
* providers: [
|
|
6549
|
+
* provideRouter(appRoutes,
|
|
6550
|
+
* withDebugTracing(),
|
|
6551
|
+
* withRouterConfig({paramsInheritanceStrategy: 'always'}))
|
|
6552
|
+
* ]
|
|
6553
|
+
* }
|
|
6554
|
+
* );
|
|
6555
|
+
* ```
|
|
6556
|
+
*
|
|
6557
|
+
* @see `RouterFeatures`
|
|
6558
|
+
*
|
|
6559
|
+
* @publicApi
|
|
6560
|
+
* @developerPreview
|
|
6561
|
+
* @param routes A set of `Route`s to use for the application routing table.
|
|
6562
|
+
* @param features Optional features to configure additional router behaviors.
|
|
6563
|
+
* @returns A set of providers to setup a Router.
|
|
6564
|
+
*/
|
|
6565
|
+
function provideRouter(routes, ...features) {
|
|
6566
|
+
return [
|
|
6567
|
+
provideRoutes(routes), { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6568
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
6569
|
+
features.map(feature => feature.ɵproviders),
|
|
6570
|
+
// TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
|
|
6571
|
+
// how we want them to be configured. This API doesn't currently have a way to configure them
|
|
6572
|
+
// and we should decide what the _best_ way to do that is rather than just sticking with the
|
|
6573
|
+
// status quo of how it's done today.
|
|
6574
|
+
];
|
|
6575
|
+
}
|
|
6576
|
+
function rootRoute(router) {
|
|
6577
|
+
return router.routerState.root;
|
|
6578
|
+
}
|
|
6579
|
+
/**
|
|
6580
|
+
* Helper function to create an object that represents a Router feature.
|
|
6581
|
+
*/
|
|
6582
|
+
function routerFeature(kind, providers) {
|
|
6583
|
+
return { ɵkind: kind, ɵproviders: providers };
|
|
6584
|
+
}
|
|
6585
|
+
/**
|
|
6586
|
+
* Registers a [DI provider](guide/glossary#provider) for a set of routes.
|
|
6587
|
+
* @param routes The route configuration to provide.
|
|
6588
|
+
*
|
|
6589
|
+
* @usageNotes
|
|
6590
|
+
*
|
|
6591
|
+
* ```
|
|
6592
|
+
* @NgModule({
|
|
6593
|
+
* providers: [provideRoutes(ROUTES)]
|
|
6594
|
+
* })
|
|
6595
|
+
* class LazyLoadedChildModule {}
|
|
6596
|
+
* ```
|
|
6597
|
+
*
|
|
6598
|
+
* @publicApi
|
|
6599
|
+
*/
|
|
6600
|
+
function provideRoutes(routes) {
|
|
6601
|
+
return [
|
|
6602
|
+
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6603
|
+
];
|
|
6604
|
+
}
|
|
6605
|
+
/**
|
|
6606
|
+
* Enables customizable scrolling behavior for router navigations.
|
|
6607
|
+
*
|
|
6608
|
+
* @usageNotes
|
|
6609
|
+
*
|
|
6610
|
+
* Basic example of how you can enable scrolling feature:
|
|
6611
|
+
* ```
|
|
6612
|
+
* const appRoutes: Routes = [];
|
|
6613
|
+
* bootstrapApplication(AppComponent,
|
|
6614
|
+
* {
|
|
6615
|
+
* providers: [
|
|
6616
|
+
* provideRouter(appRoutes, withInMemoryScrolling())
|
|
6617
|
+
* ]
|
|
6618
|
+
* }
|
|
6619
|
+
* );
|
|
6620
|
+
* ```
|
|
6621
|
+
*
|
|
6622
|
+
* @see `provideRouter`
|
|
6623
|
+
* @see `ViewportScroller`
|
|
6624
|
+
*
|
|
6625
|
+
* @publicApi
|
|
6626
|
+
* @developerPreview
|
|
6627
|
+
* @param options Set of configuration parameters to customize scrolling behavior, see
|
|
6628
|
+
* `InMemoryScrollingOptions` for additional information.
|
|
6629
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6630
|
+
*/
|
|
6631
|
+
function withInMemoryScrolling(options = {}) {
|
|
6632
|
+
const providers = [{
|
|
6633
|
+
provide: ROUTER_SCROLLER,
|
|
6634
|
+
useFactory: () => {
|
|
6635
|
+
const router = inject(Router);
|
|
6636
|
+
const viewportScroller = inject(ViewportScroller);
|
|
6637
|
+
return new RouterScroller(router, viewportScroller, options);
|
|
6638
|
+
},
|
|
6639
|
+
}];
|
|
6640
|
+
return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
|
|
6641
|
+
}
|
|
6642
|
+
function getBootstrapListener() {
|
|
6643
|
+
const injector = inject(Injector);
|
|
6644
|
+
return (bootstrappedComponentRef) => {
|
|
6645
|
+
var _a, _b;
|
|
6646
|
+
const ref = injector.get(ApplicationRef);
|
|
6647
|
+
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6648
|
+
return;
|
|
6649
|
+
}
|
|
6650
|
+
const router = injector.get(Router);
|
|
6651
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6652
|
+
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6653
|
+
router.initialNavigation();
|
|
6654
|
+
}
|
|
6655
|
+
(_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
|
|
6656
|
+
(_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
|
|
6657
|
+
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6658
|
+
bootstrapDone.next();
|
|
6659
|
+
bootstrapDone.complete();
|
|
6660
|
+
};
|
|
6661
|
+
}
|
|
6662
|
+
/**
|
|
6663
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6664
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6665
|
+
* to the activation phase.
|
|
6666
|
+
*/
|
|
6667
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE$1 ? 'bootstrap done indicator' : '', {
|
|
6668
|
+
factory: () => {
|
|
6669
|
+
return new Subject();
|
|
6670
|
+
}
|
|
6671
|
+
});
|
|
6672
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE$1 ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6673
|
+
/**
|
|
6674
|
+
* Configures initial navigation to start before the root component is created.
|
|
6675
|
+
*
|
|
6676
|
+
* The bootstrap is blocked until the initial navigation is complete. This value is required for
|
|
6677
|
+
* [server-side rendering](guide/universal) to work.
|
|
6678
|
+
*
|
|
6679
|
+
* @usageNotes
|
|
6680
|
+
*
|
|
6681
|
+
* Basic example of how you can enable this navigation behavior:
|
|
6682
|
+
* ```
|
|
6683
|
+
* const appRoutes: Routes = [];
|
|
6684
|
+
* bootstrapApplication(AppComponent,
|
|
6685
|
+
* {
|
|
6686
|
+
* providers: [
|
|
6687
|
+
* provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
|
|
6688
|
+
* ]
|
|
6689
|
+
* }
|
|
6690
|
+
* );
|
|
6691
|
+
* ```
|
|
6692
|
+
*
|
|
6693
|
+
* @see `provideRouter`
|
|
6694
|
+
*
|
|
6695
|
+
* @publicApi
|
|
6696
|
+
* @developerPreview
|
|
6697
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6698
|
+
*/
|
|
6699
|
+
function withEnabledBlockingInitialNavigation() {
|
|
6700
|
+
const providers = [
|
|
6701
|
+
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6702
|
+
{
|
|
6703
|
+
provide: APP_INITIALIZER,
|
|
6704
|
+
multi: true,
|
|
6705
|
+
deps: [Injector],
|
|
6706
|
+
useFactory: (injector) => {
|
|
6707
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6708
|
+
let initNavigation = false;
|
|
6709
|
+
/**
|
|
6710
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6711
|
+
*
|
|
6712
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6713
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6714
|
+
*/
|
|
6715
|
+
function afterNextNavigation(action) {
|
|
6716
|
+
const router = injector.get(Router);
|
|
6717
|
+
router.events
|
|
6718
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6719
|
+
e instanceof NavigationError), map(e => {
|
|
6720
|
+
if (e instanceof NavigationEnd) {
|
|
6721
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6722
|
+
return true;
|
|
6723
|
+
}
|
|
6724
|
+
const redirecting = e instanceof NavigationCancel ?
|
|
6725
|
+
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6726
|
+
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6727
|
+
false;
|
|
6728
|
+
return redirecting ? null : false;
|
|
6729
|
+
}), filter((result) => result !== null), take(1))
|
|
6730
|
+
.subscribe(() => {
|
|
6731
|
+
action();
|
|
6732
|
+
});
|
|
6733
|
+
}
|
|
6734
|
+
return () => {
|
|
6735
|
+
return locationInitialized.then(() => {
|
|
6736
|
+
return new Promise(resolve => {
|
|
6737
|
+
const router = injector.get(Router);
|
|
6738
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6739
|
+
afterNextNavigation(() => {
|
|
6740
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6741
|
+
// without a redirect.
|
|
6742
|
+
resolve(true);
|
|
6743
|
+
initNavigation = true;
|
|
6744
|
+
});
|
|
6745
|
+
router.afterPreactivation = () => {
|
|
6746
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6747
|
+
// assume activation will complete successfully (even though this is not
|
|
6748
|
+
// guaranteed).
|
|
6749
|
+
resolve(true);
|
|
6750
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6751
|
+
if (!initNavigation) {
|
|
6752
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6753
|
+
// subsequent navigations should not be delayed
|
|
6754
|
+
}
|
|
6755
|
+
else {
|
|
6756
|
+
return of(void 0);
|
|
6757
|
+
}
|
|
6758
|
+
};
|
|
6759
|
+
router.initialNavigation();
|
|
6760
|
+
});
|
|
6761
|
+
});
|
|
6762
|
+
};
|
|
6763
|
+
}
|
|
6764
|
+
},
|
|
6765
|
+
];
|
|
6766
|
+
return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);
|
|
6767
|
+
}
|
|
6768
|
+
/**
|
|
6769
|
+
* Disables initial navigation.
|
|
6770
|
+
*
|
|
6771
|
+
* Use if there is a reason to have more control over when the router starts its initial navigation
|
|
6772
|
+
* due to some complex initialization logic.
|
|
6773
|
+
*
|
|
6774
|
+
* @usageNotes
|
|
6775
|
+
*
|
|
6776
|
+
* Basic example of how you can disable initial navigation:
|
|
6777
|
+
* ```
|
|
6778
|
+
* const appRoutes: Routes = [];
|
|
6779
|
+
* bootstrapApplication(AppComponent,
|
|
6780
|
+
* {
|
|
6781
|
+
* providers: [
|
|
6782
|
+
* provideRouter(appRoutes, withDisabledInitialNavigation())
|
|
6783
|
+
* ]
|
|
6784
|
+
* }
|
|
6785
|
+
* );
|
|
6786
|
+
* ```
|
|
6787
|
+
*
|
|
6788
|
+
* @see `provideRouter`
|
|
6789
|
+
*
|
|
6790
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6791
|
+
*
|
|
6792
|
+
* @publicApi
|
|
6793
|
+
* @developerPreview
|
|
6794
|
+
*/
|
|
6795
|
+
function withDisabledInitialNavigation() {
|
|
6796
|
+
const providers = [
|
|
6797
|
+
{
|
|
6798
|
+
provide: APP_INITIALIZER,
|
|
6799
|
+
multi: true,
|
|
6800
|
+
useFactory: () => {
|
|
6801
|
+
const router = inject(Router);
|
|
6802
|
+
return () => {
|
|
6803
|
+
router.setUpLocationChangeListener();
|
|
6804
|
+
};
|
|
6805
|
+
}
|
|
6806
|
+
},
|
|
6807
|
+
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6808
|
+
];
|
|
6809
|
+
return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);
|
|
6810
|
+
}
|
|
6811
|
+
/**
|
|
6812
|
+
* Enables logging of all internal navigation events to the console.
|
|
6813
|
+
* Extra logging might be useful for debugging purposes to inspect Router event sequence.
|
|
6814
|
+
*
|
|
6815
|
+
* @usageNotes
|
|
6816
|
+
*
|
|
6817
|
+
* Basic example of how you can enable debug tracing:
|
|
6818
|
+
* ```
|
|
6819
|
+
* const appRoutes: Routes = [];
|
|
6820
|
+
* bootstrapApplication(AppComponent,
|
|
6821
|
+
* {
|
|
6822
|
+
* providers: [
|
|
6823
|
+
* provideRouter(appRoutes, withDebugTracing())
|
|
6824
|
+
* ]
|
|
6825
|
+
* }
|
|
6826
|
+
* );
|
|
6827
|
+
* ```
|
|
6828
|
+
*
|
|
6829
|
+
* @see `provideRouter`
|
|
6830
|
+
*
|
|
6831
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6832
|
+
*
|
|
6833
|
+
* @publicApi
|
|
6834
|
+
* @developerPreview
|
|
6835
|
+
*/
|
|
6836
|
+
function withDebugTracing() {
|
|
6837
|
+
let providers = [];
|
|
6838
|
+
if (NG_DEV_MODE$1) {
|
|
6839
|
+
providers = [{
|
|
6840
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6841
|
+
multi: true,
|
|
6842
|
+
useFactory: () => {
|
|
6843
|
+
const router = inject(Router);
|
|
6844
|
+
return () => router.events.subscribe((e) => {
|
|
6845
|
+
var _a, _b;
|
|
6846
|
+
// tslint:disable:no-console
|
|
6847
|
+
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6848
|
+
console.log(stringifyEvent(e));
|
|
6849
|
+
console.log(e);
|
|
6850
|
+
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6851
|
+
// tslint:enable:no-console
|
|
6852
|
+
});
|
|
6853
|
+
}
|
|
6854
|
+
}];
|
|
6855
|
+
}
|
|
6856
|
+
else {
|
|
6857
|
+
providers = [];
|
|
6858
|
+
}
|
|
6859
|
+
return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
|
|
6860
|
+
}
|
|
6861
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE$1 ? 'router preloader' : '');
|
|
6862
|
+
/**
|
|
6863
|
+
* Allows to configure a preloading strategy to use. The strategy is configured by providing a
|
|
6864
|
+
* reference to a class that implements a `PreloadingStrategy`.
|
|
6865
|
+
*
|
|
6866
|
+
* @usageNotes
|
|
6867
|
+
*
|
|
6868
|
+
* Basic example of how you can configure preloading:
|
|
6869
|
+
* ```
|
|
6870
|
+
* const appRoutes: Routes = [];
|
|
6871
|
+
* bootstrapApplication(AppComponent,
|
|
6872
|
+
* {
|
|
6873
|
+
* providers: [
|
|
6874
|
+
* provideRouter(appRoutes, withPreloading(PreloadAllModules))
|
|
6875
|
+
* ]
|
|
6876
|
+
* }
|
|
6877
|
+
* );
|
|
6878
|
+
* ```
|
|
6879
|
+
*
|
|
6880
|
+
* @see `provideRouter`
|
|
6881
|
+
*
|
|
6882
|
+
* @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
|
|
6883
|
+
* should be used.
|
|
6884
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6885
|
+
*
|
|
6886
|
+
* @publicApi
|
|
6887
|
+
* @developerPreview
|
|
6888
|
+
*/
|
|
6889
|
+
function withPreloading(preloadingStrategy) {
|
|
6890
|
+
const providers = [
|
|
6891
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6892
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6893
|
+
];
|
|
6894
|
+
return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);
|
|
6895
|
+
}
|
|
6896
|
+
/**
|
|
6897
|
+
* Allows to provide extra parameters to configure Router.
|
|
6898
|
+
*
|
|
6899
|
+
* @usageNotes
|
|
6900
|
+
*
|
|
6901
|
+
* Basic example of how you can provide extra configuration options:
|
|
6902
|
+
* ```
|
|
6903
|
+
* const appRoutes: Routes = [];
|
|
6904
|
+
* bootstrapApplication(AppComponent,
|
|
6905
|
+
* {
|
|
6906
|
+
* providers: [
|
|
6907
|
+
* provideRouter(appRoutes, withRouterConfig({
|
|
6908
|
+
* onSameUrlNavigation: 'reload'
|
|
6909
|
+
* }))
|
|
6910
|
+
* ]
|
|
6911
|
+
* }
|
|
6912
|
+
* );
|
|
6913
|
+
* ```
|
|
6914
|
+
*
|
|
6915
|
+
* @see `provideRouter`
|
|
6916
|
+
*
|
|
6917
|
+
* @param options A set of parameters to configure Router, see `RouterConfigOptions` for
|
|
6918
|
+
* additional information.
|
|
6919
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6920
|
+
*
|
|
6921
|
+
* @publicApi
|
|
6922
|
+
* @developerPreview
|
|
6923
|
+
*/
|
|
6924
|
+
function withRouterConfig(options) {
|
|
6925
|
+
const providers = [
|
|
6926
|
+
{ provide: ROUTER_CONFIGURATION, useValue: options },
|
|
6927
|
+
];
|
|
6928
|
+
return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);
|
|
6929
|
+
}
|
|
6930
|
+
|
|
6384
6931
|
/**
|
|
6385
6932
|
* @license
|
|
6386
6933
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6397,7 +6944,6 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6397
6944
|
* @docsNotRequired
|
|
6398
6945
|
*/
|
|
6399
6946
|
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6400
|
-
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6401
6947
|
// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
|
|
6402
6948
|
// here to avoid a breaking change whereby the provider order matters based on where the
|
|
6403
6949
|
// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
|
|
@@ -6410,9 +6956,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6410
6956
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6411
6957
|
RouterConfigLoader,
|
|
6412
6958
|
];
|
|
6413
|
-
function rootRoute(router) {
|
|
6414
|
-
return router.routerState.root;
|
|
6415
|
-
}
|
|
6416
6959
|
function routerNgProbeToken() {
|
|
6417
6960
|
return new NgProbeToken('Router', Router);
|
|
6418
6961
|
}
|
|
@@ -6462,7 +7005,7 @@ class RouterModule {
|
|
|
6462
7005
|
ngModule: RouterModule,
|
|
6463
7006
|
providers: [
|
|
6464
7007
|
ROUTER_PROVIDERS,
|
|
6465
|
-
NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ?
|
|
7008
|
+
NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ? withDebugTracing().ɵproviders : []) : [],
|
|
6466
7009
|
provideRoutes(routes),
|
|
6467
7010
|
{
|
|
6468
7011
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6472,7 +7015,7 @@ class RouterModule {
|
|
|
6472
7015
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6473
7016
|
(config === null || config === void 0 ? void 0 : config.useHash) ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6474
7017
|
provideRouterScroller(),
|
|
6475
|
-
(config === null || config === void 0 ? void 0 : config.preloadingStrategy) ?
|
|
7018
|
+
(config === null || config === void 0 ? void 0 : config.preloadingStrategy) ? withPreloading(config.preloadingStrategy).ɵproviders : [],
|
|
6476
7019
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6477
7020
|
(config === null || config === void 0 ? void 0 : config.initialNavigation) ? provideInitialNavigation(config) : [],
|
|
6478
7021
|
provideRouterInitializer(),
|
|
@@ -6499,13 +7042,13 @@ class RouterModule {
|
|
|
6499
7042
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6500
7043
|
}
|
|
6501
7044
|
}
|
|
6502
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
6503
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
|
|
6504
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.
|
|
6505
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
7045
|
+
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 });
|
|
7046
|
+
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] });
|
|
7047
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
|
|
7048
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-rc.0", ngImport: i0, type: RouterModule, decorators: [{
|
|
6506
7049
|
type: NgModule,
|
|
6507
7050
|
args: [{
|
|
6508
|
-
|
|
7051
|
+
imports: ROUTER_DIRECTIVES,
|
|
6509
7052
|
exports: ROUTER_DIRECTIVES,
|
|
6510
7053
|
}]
|
|
6511
7054
|
}], ctorParameters: function () {
|
|
@@ -6516,6 +7059,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
6516
7059
|
args: [ROUTER_FORROOT_GUARD]
|
|
6517
7060
|
}] }];
|
|
6518
7061
|
} });
|
|
7062
|
+
/**
|
|
7063
|
+
* For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`
|
|
7064
|
+
* because it reads from the `ExtraOptions` which should not be used in the standalone world.
|
|
7065
|
+
*/
|
|
6519
7066
|
function provideRouterScroller() {
|
|
6520
7067
|
return {
|
|
6521
7068
|
provide: ROUTER_SCROLLER,
|
|
@@ -6530,9 +7077,13 @@ function provideRouterScroller() {
|
|
|
6530
7077
|
},
|
|
6531
7078
|
};
|
|
6532
7079
|
}
|
|
7080
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should
|
|
7081
|
+
// provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.
|
|
6533
7082
|
function provideHashLocationStrategy() {
|
|
6534
7083
|
return { provide: LocationStrategy, useClass: HashLocationStrategy };
|
|
6535
7084
|
}
|
|
7085
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not
|
|
7086
|
+
// need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.
|
|
6536
7087
|
function providePathLocationStrategy() {
|
|
6537
7088
|
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6538
7089
|
}
|
|
@@ -6543,47 +7094,16 @@ function provideForRootGuard(router) {
|
|
|
6543
7094
|
}
|
|
6544
7095
|
return 'guarded';
|
|
6545
7096
|
}
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
*
|
|
6550
|
-
* @usageNotes
|
|
6551
|
-
*
|
|
6552
|
-
* ```
|
|
6553
|
-
* @NgModule({
|
|
6554
|
-
* imports: [RouterModule.forChild(ROUTES)],
|
|
6555
|
-
* providers: [provideRoutes(EXTRA_ROUTES)]
|
|
6556
|
-
* })
|
|
6557
|
-
* class MyNgModule {}
|
|
6558
|
-
* ```
|
|
6559
|
-
*
|
|
6560
|
-
* @publicApi
|
|
6561
|
-
*/
|
|
6562
|
-
function provideRoutes(routes) {
|
|
7097
|
+
// Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`
|
|
7098
|
+
// users call `withXInitialNavigation` directly.
|
|
7099
|
+
function provideInitialNavigation(config) {
|
|
6563
7100
|
return [
|
|
6564
|
-
|
|
7101
|
+
config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [],
|
|
7102
|
+
config.initialNavigation === 'enabledBlocking' ?
|
|
7103
|
+
withEnabledBlockingInitialNavigation().ɵproviders :
|
|
7104
|
+
[],
|
|
6565
7105
|
];
|
|
6566
7106
|
}
|
|
6567
|
-
function getBootstrapListener() {
|
|
6568
|
-
const injector = inject(Injector);
|
|
6569
|
-
return (bootstrappedComponentRef) => {
|
|
6570
|
-
var _a, _b;
|
|
6571
|
-
const ref = injector.get(ApplicationRef);
|
|
6572
|
-
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6573
|
-
return;
|
|
6574
|
-
}
|
|
6575
|
-
const router = injector.get(Router);
|
|
6576
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6577
|
-
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6578
|
-
router.initialNavigation();
|
|
6579
|
-
}
|
|
6580
|
-
(_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
|
|
6581
|
-
(_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
|
|
6582
|
-
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6583
|
-
bootstrapDone.next();
|
|
6584
|
-
bootstrapDone.complete();
|
|
6585
|
-
};
|
|
6586
|
-
}
|
|
6587
7107
|
// TODO(atscott): This should not be in the public API
|
|
6588
7108
|
/**
|
|
6589
7109
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
@@ -6592,12 +7112,6 @@ function getBootstrapListener() {
|
|
|
6592
7112
|
* @publicApi
|
|
6593
7113
|
*/
|
|
6594
7114
|
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6595
|
-
function provideInitialNavigation(config) {
|
|
6596
|
-
return [
|
|
6597
|
-
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6598
|
-
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6599
|
-
];
|
|
6600
|
-
}
|
|
6601
7115
|
function provideRouterInitializer() {
|
|
6602
7116
|
return [
|
|
6603
7117
|
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
@@ -6606,130 +7120,6 @@ function provideRouterInitializer() {
|
|
|
6606
7120
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6607
7121
|
];
|
|
6608
7122
|
}
|
|
6609
|
-
/**
|
|
6610
|
-
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6611
|
-
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6612
|
-
* to the activation phase.
|
|
6613
|
-
*/
|
|
6614
|
-
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6615
|
-
factory: () => {
|
|
6616
|
-
return new Subject();
|
|
6617
|
-
}
|
|
6618
|
-
});
|
|
6619
|
-
function provideEnabledBlockingInitialNavigation() {
|
|
6620
|
-
return [
|
|
6621
|
-
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6622
|
-
{
|
|
6623
|
-
provide: APP_INITIALIZER,
|
|
6624
|
-
multi: true,
|
|
6625
|
-
deps: [Injector],
|
|
6626
|
-
useFactory: (injector) => {
|
|
6627
|
-
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6628
|
-
let initNavigation = false;
|
|
6629
|
-
/**
|
|
6630
|
-
* Performs the given action once the router finishes its next/current navigation.
|
|
6631
|
-
*
|
|
6632
|
-
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6633
|
-
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6634
|
-
*/
|
|
6635
|
-
function afterNextNavigation(action) {
|
|
6636
|
-
const router = injector.get(Router);
|
|
6637
|
-
router.events
|
|
6638
|
-
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6639
|
-
e instanceof NavigationError), map(e => {
|
|
6640
|
-
if (e instanceof NavigationEnd) {
|
|
6641
|
-
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6642
|
-
return true;
|
|
6643
|
-
}
|
|
6644
|
-
const redirecting = e instanceof NavigationCancel ?
|
|
6645
|
-
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6646
|
-
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6647
|
-
false;
|
|
6648
|
-
return redirecting ? null : false;
|
|
6649
|
-
}), filter((result) => result !== null), take(1))
|
|
6650
|
-
.subscribe(() => {
|
|
6651
|
-
action();
|
|
6652
|
-
});
|
|
6653
|
-
}
|
|
6654
|
-
return () => {
|
|
6655
|
-
return locationInitialized.then(() => {
|
|
6656
|
-
return new Promise(resolve => {
|
|
6657
|
-
const router = injector.get(Router);
|
|
6658
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6659
|
-
afterNextNavigation(() => {
|
|
6660
|
-
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6661
|
-
// without a redirect.
|
|
6662
|
-
resolve(true);
|
|
6663
|
-
initNavigation = true;
|
|
6664
|
-
});
|
|
6665
|
-
router.afterPreactivation = () => {
|
|
6666
|
-
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6667
|
-
// assume activation will complete successfully (even though this is not
|
|
6668
|
-
// guaranteed).
|
|
6669
|
-
resolve(true);
|
|
6670
|
-
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6671
|
-
if (!initNavigation) {
|
|
6672
|
-
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6673
|
-
// subsequent navigations should not be delayed
|
|
6674
|
-
}
|
|
6675
|
-
else {
|
|
6676
|
-
return of(void 0);
|
|
6677
|
-
}
|
|
6678
|
-
};
|
|
6679
|
-
router.initialNavigation();
|
|
6680
|
-
});
|
|
6681
|
-
});
|
|
6682
|
-
};
|
|
6683
|
-
}
|
|
6684
|
-
},
|
|
6685
|
-
];
|
|
6686
|
-
}
|
|
6687
|
-
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6688
|
-
function provideDisabledInitialNavigation() {
|
|
6689
|
-
return [
|
|
6690
|
-
{
|
|
6691
|
-
provide: APP_INITIALIZER,
|
|
6692
|
-
multi: true,
|
|
6693
|
-
useFactory: () => {
|
|
6694
|
-
const router = inject(Router);
|
|
6695
|
-
return () => {
|
|
6696
|
-
router.setUpLocationChangeListener();
|
|
6697
|
-
};
|
|
6698
|
-
}
|
|
6699
|
-
},
|
|
6700
|
-
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6701
|
-
];
|
|
6702
|
-
}
|
|
6703
|
-
function provideTracing() {
|
|
6704
|
-
if (NG_DEV_MODE) {
|
|
6705
|
-
return [{
|
|
6706
|
-
provide: ENVIRONMENT_INITIALIZER,
|
|
6707
|
-
multi: true,
|
|
6708
|
-
useFactory: () => {
|
|
6709
|
-
const router = inject(Router);
|
|
6710
|
-
return () => router.events.subscribe((e) => {
|
|
6711
|
-
var _a, _b;
|
|
6712
|
-
// tslint:disable:no-console
|
|
6713
|
-
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6714
|
-
console.log(stringifyEvent(e));
|
|
6715
|
-
console.log(e);
|
|
6716
|
-
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6717
|
-
// tslint:enable:no-console
|
|
6718
|
-
});
|
|
6719
|
-
}
|
|
6720
|
-
}];
|
|
6721
|
-
}
|
|
6722
|
-
else {
|
|
6723
|
-
return [];
|
|
6724
|
-
}
|
|
6725
|
-
}
|
|
6726
|
-
function providePreloading(preloadingStrategy) {
|
|
6727
|
-
return [
|
|
6728
|
-
RouterPreloader,
|
|
6729
|
-
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6730
|
-
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6731
|
-
];
|
|
6732
|
-
}
|
|
6733
7123
|
|
|
6734
7124
|
/**
|
|
6735
7125
|
* @license
|
|
@@ -6741,7 +7131,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6741
7131
|
/**
|
|
6742
7132
|
* @publicApi
|
|
6743
7133
|
*/
|
|
6744
|
-
const VERSION = new Version('14.
|
|
7134
|
+
const VERSION = new Version('14.2.0-rc.0');
|
|
6745
7135
|
|
|
6746
7136
|
/**
|
|
6747
7137
|
* @license
|
|
@@ -6780,5 +7170,5 @@ const VERSION = new Version('14.1.3');
|
|
|
6780
7170
|
* Generated bundle index. Do not edit.
|
|
6781
7171
|
*/
|
|
6782
7172
|
|
|
6783
|
-
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,
|
|
7173
|
+
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 };
|
|
6784
7174
|
//# sourceMappingURL=router.mjs.map
|