@angular/router 14.0.2 → 14.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/apply_redirects.mjs +14 -18
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/create_url_tree.mjs +6 -4
- package/esm2020/src/directives/router_link.mjs +6 -6
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +14 -10
- package/esm2020/src/errors.mjs +2 -0
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/operators/check_guards.mjs +12 -35
- package/esm2020/src/page_title_strategy.mjs +3 -3
- package/esm2020/src/private_export.mjs +2 -2
- package/esm2020/src/recognize.mjs +3 -2
- package/esm2020/src/router.mjs +12 -10
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +192 -138
- package/esm2020/src/router_preloader.mjs +16 -4
- package/esm2020/src/router_scroller.mjs +6 -5
- package/esm2020/src/shared.mjs +3 -2
- package/esm2020/src/url_tree.mjs +6 -4
- package/esm2020/src/utils/config.mjs +17 -17
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +8 -8
- package/fesm2015/router.mjs +303 -255
- 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 +300 -254
- 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 +21 -3
- package/package.json +4 -4
- package/testing/index.d.ts +2 -2
- package/upgrade/index.d.ts +1 -1
package/fesm2015/router.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.
|
|
2
|
+
* @license Angular v14.0.5
|
|
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, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
|
|
9
9
|
import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, mapTo, finalize, refCount, defaultIfEmpty, mergeAll } from 'rxjs/operators';
|
|
11
11
|
import * as i3 from '@angular/common';
|
|
12
|
-
import { Location, LocationStrategy,
|
|
12
|
+
import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
|
|
13
13
|
import * as i1 from '@angular/platform-browser';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -520,9 +520,10 @@ class ParamsAsMap {
|
|
|
520
520
|
function convertToParamMap(params) {
|
|
521
521
|
return new ParamsAsMap(params);
|
|
522
522
|
}
|
|
523
|
+
const REDIRECTING_CANCELLATION_REASON = 'Redirecting to ';
|
|
523
524
|
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
|
524
525
|
function navigationCancelingError(message) {
|
|
525
|
-
const error = Error('NavigationCancelingError: ' + message);
|
|
526
|
+
const error = Error('NavigationCancelingError: ' + (message || ''));
|
|
526
527
|
error[NAVIGATION_CANCELING_ERROR] = true;
|
|
527
528
|
return error;
|
|
528
529
|
}
|
|
@@ -651,6 +652,7 @@ function wrapIntoObservable(value) {
|
|
|
651
652
|
* Use of this source code is governed by an MIT-style license that can be
|
|
652
653
|
* found in the LICENSE file at https://angular.io/license
|
|
653
654
|
*/
|
|
655
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
654
656
|
function createEmptyUrlTree() {
|
|
655
657
|
return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
|
|
656
658
|
}
|
|
@@ -1115,7 +1117,7 @@ class UrlParser {
|
|
|
1115
1117
|
parseSegment() {
|
|
1116
1118
|
const path = matchSegments(this.remaining);
|
|
1117
1119
|
if (path === '' && this.peekStartsWith(';')) {
|
|
1118
|
-
throw new
|
|
1120
|
+
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
|
|
1119
1121
|
}
|
|
1120
1122
|
this.capture(path);
|
|
1121
1123
|
return new UrlSegment(decode(path), this.parseMatrixParams());
|
|
@@ -1184,7 +1186,7 @@ class UrlParser {
|
|
|
1184
1186
|
// if is is not one of these characters, then the segment was unescaped
|
|
1185
1187
|
// or the group was not closed
|
|
1186
1188
|
if (next !== '/' && next !== ')' && next !== ';') {
|
|
1187
|
-
throw new
|
|
1189
|
+
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
|
|
1188
1190
|
}
|
|
1189
1191
|
let outletName = undefined;
|
|
1190
1192
|
if (path.indexOf(':') > -1) {
|
|
@@ -1215,7 +1217,7 @@ class UrlParser {
|
|
|
1215
1217
|
}
|
|
1216
1218
|
capture(str) {
|
|
1217
1219
|
if (!this.consumeOptional(str)) {
|
|
1218
|
-
throw new
|
|
1220
|
+
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
|
|
1219
1221
|
}
|
|
1220
1222
|
}
|
|
1221
1223
|
}
|
|
@@ -1769,6 +1771,7 @@ function createActivatedRoute(c) {
|
|
|
1769
1771
|
* Use of this source code is governed by an MIT-style license that can be
|
|
1770
1772
|
* found in the LICENSE file at https://angular.io/license
|
|
1771
1773
|
*/
|
|
1774
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
1772
1775
|
function createUrlTree(route, urlTree, commands, queryParams, fragment) {
|
|
1773
1776
|
var _a, _b;
|
|
1774
1777
|
if (commands.length === 0) {
|
|
@@ -1841,11 +1844,11 @@ class Navigation {
|
|
|
1841
1844
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
1842
1845
|
this.commands = commands;
|
|
1843
1846
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
1844
|
-
throw new
|
|
1847
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
|
|
1845
1848
|
}
|
|
1846
1849
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
1847
1850
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
1848
|
-
throw new
|
|
1851
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
|
|
1849
1852
|
}
|
|
1850
1853
|
}
|
|
1851
1854
|
toRoot() {
|
|
@@ -1926,7 +1929,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1926
1929
|
dd -= ci;
|
|
1927
1930
|
g = g.parent;
|
|
1928
1931
|
if (!g) {
|
|
1929
|
-
throw new
|
|
1932
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
|
|
1930
1933
|
}
|
|
1931
1934
|
ci = g.segments.length;
|
|
1932
1935
|
}
|
|
@@ -2158,6 +2161,7 @@ class ChildrenOutletContexts {
|
|
|
2158
2161
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2159
2162
|
* found in the LICENSE file at https://angular.io/license
|
|
2160
2163
|
*/
|
|
2164
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2161
2165
|
/**
|
|
2162
2166
|
* @description
|
|
2163
2167
|
*
|
|
@@ -2234,7 +2238,11 @@ class RouterOutlet {
|
|
|
2234
2238
|
}
|
|
2235
2239
|
/** @nodoc */
|
|
2236
2240
|
ngOnDestroy() {
|
|
2237
|
-
|
|
2241
|
+
var _a;
|
|
2242
|
+
// Ensure that the registered outlet is this one before removing it on the context.
|
|
2243
|
+
if (((_a = this.parentContexts.getContext(this.name)) === null || _a === void 0 ? void 0 : _a.outlet) === this) {
|
|
2244
|
+
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
2245
|
+
}
|
|
2238
2246
|
}
|
|
2239
2247
|
/** @nodoc */
|
|
2240
2248
|
ngOnInit() {
|
|
@@ -2263,12 +2271,12 @@ class RouterOutlet {
|
|
|
2263
2271
|
*/
|
|
2264
2272
|
get component() {
|
|
2265
2273
|
if (!this.activated)
|
|
2266
|
-
throw new
|
|
2274
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2267
2275
|
return this.activated.instance;
|
|
2268
2276
|
}
|
|
2269
2277
|
get activatedRoute() {
|
|
2270
2278
|
if (!this.activated)
|
|
2271
|
-
throw new
|
|
2279
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2272
2280
|
return this._activatedRoute;
|
|
2273
2281
|
}
|
|
2274
2282
|
get activatedRouteData() {
|
|
@@ -2282,7 +2290,7 @@ class RouterOutlet {
|
|
|
2282
2290
|
*/
|
|
2283
2291
|
detach() {
|
|
2284
2292
|
if (!this.activated)
|
|
2285
|
-
throw new
|
|
2293
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2286
2294
|
this.location.detach();
|
|
2287
2295
|
const cmp = this.activated;
|
|
2288
2296
|
this.activated = null;
|
|
@@ -2310,7 +2318,7 @@ class RouterOutlet {
|
|
|
2310
2318
|
}
|
|
2311
2319
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2312
2320
|
if (this.isActivated) {
|
|
2313
|
-
throw new
|
|
2321
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
|
|
2314
2322
|
}
|
|
2315
2323
|
this._activatedRoute = activatedRoute;
|
|
2316
2324
|
const location = this.location;
|
|
@@ -2332,9 +2340,9 @@ class RouterOutlet {
|
|
|
2332
2340
|
this.activateEvents.emit(this.activated.instance);
|
|
2333
2341
|
}
|
|
2334
2342
|
}
|
|
2335
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2336
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
2337
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2343
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2344
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2345
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2338
2346
|
type: Directive,
|
|
2339
2347
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2340
2348
|
}], ctorParameters: function () {
|
|
@@ -2393,9 +2401,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2393
2401
|
*/
|
|
2394
2402
|
class ɵEmptyOutletComponent {
|
|
2395
2403
|
}
|
|
2396
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2397
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.
|
|
2398
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2404
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2405
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.5", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2399
2407
|
type: Component,
|
|
2400
2408
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2401
2409
|
}] });
|
|
@@ -2445,13 +2453,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
|
|
|
2445
2453
|
}
|
|
2446
2454
|
function assertStandalone(fullPath, component) {
|
|
2447
2455
|
if (component && !ɵisStandalone(component)) {
|
|
2448
|
-
throw new
|
|
2456
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
|
|
2449
2457
|
}
|
|
2450
2458
|
}
|
|
2451
2459
|
function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
2452
2460
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2453
2461
|
if (!route) {
|
|
2454
|
-
throw new
|
|
2462
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
|
|
2455
2463
|
Invalid configuration of route '${fullPath}': Encountered undefined route.
|
|
2456
2464
|
The reason might be an extra comma.
|
|
2457
2465
|
|
|
@@ -2464,47 +2472,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
|
2464
2472
|
`);
|
|
2465
2473
|
}
|
|
2466
2474
|
if (Array.isArray(route)) {
|
|
2467
|
-
throw new
|
|
2475
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
|
|
2468
2476
|
}
|
|
2469
2477
|
if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
|
|
2470
2478
|
(route.outlet && route.outlet !== PRIMARY_OUTLET)) {
|
|
2471
|
-
throw new
|
|
2479
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
|
|
2472
2480
|
}
|
|
2473
2481
|
if (route.redirectTo && route.children) {
|
|
2474
|
-
throw new
|
|
2482
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
|
|
2475
2483
|
}
|
|
2476
2484
|
if (route.redirectTo && route.loadChildren) {
|
|
2477
|
-
throw new
|
|
2485
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
|
|
2478
2486
|
}
|
|
2479
2487
|
if (route.children && route.loadChildren) {
|
|
2480
|
-
throw new
|
|
2488
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
|
|
2481
2489
|
}
|
|
2482
2490
|
if (route.redirectTo && (route.component || route.loadComponent)) {
|
|
2483
|
-
throw new
|
|
2491
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
|
|
2484
2492
|
}
|
|
2485
2493
|
if (route.component && route.loadComponent) {
|
|
2486
|
-
throw new
|
|
2494
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
|
|
2487
2495
|
}
|
|
2488
2496
|
if (route.redirectTo && route.canActivate) {
|
|
2489
|
-
throw new
|
|
2497
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
|
|
2490
2498
|
`so canActivate will never be executed.`);
|
|
2491
2499
|
}
|
|
2492
2500
|
if (route.path && route.matcher) {
|
|
2493
|
-
throw new
|
|
2501
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
|
|
2494
2502
|
}
|
|
2495
2503
|
if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
|
|
2496
2504
|
!route.children && !route.loadChildren) {
|
|
2497
|
-
throw new
|
|
2505
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
|
|
2498
2506
|
}
|
|
2499
2507
|
if (route.path === void 0 && route.matcher === void 0) {
|
|
2500
|
-
throw new
|
|
2508
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
|
|
2501
2509
|
}
|
|
2502
2510
|
if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
|
|
2503
|
-
throw new
|
|
2511
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
|
|
2504
2512
|
}
|
|
2505
2513
|
if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
|
|
2506
2514
|
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
|
|
2507
|
-
throw new
|
|
2515
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
|
2508
2516
|
}
|
|
2509
2517
|
if (requireStandaloneComponents) {
|
|
2510
2518
|
assertStandalone(fullPath, route.component);
|
|
@@ -3000,6 +3008,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3000
3008
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3001
3009
|
* found in the LICENSE file at https://angular.io/license
|
|
3002
3010
|
*/
|
|
3011
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3003
3012
|
class NoMatch$1 {
|
|
3004
3013
|
constructor(segmentGroup) {
|
|
3005
3014
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3017,10 +3026,12 @@ function absoluteRedirect(newTree) {
|
|
|
3017
3026
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3018
3027
|
}
|
|
3019
3028
|
function namedOutletsRedirect(redirectTo) {
|
|
3020
|
-
return throwError(new
|
|
3029
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3030
|
+
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3021
3031
|
}
|
|
3022
3032
|
function canLoadFails(route) {
|
|
3023
|
-
return throwError(navigationCancelingError(
|
|
3033
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
|
|
3034
|
+
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
|
|
3024
3035
|
}
|
|
3025
3036
|
/**
|
|
3026
3037
|
* Returns the `UrlTree` with the redirection applied.
|
|
@@ -3079,7 +3090,7 @@ class ApplyRedirects {
|
|
|
3079
3090
|
}));
|
|
3080
3091
|
}
|
|
3081
3092
|
noMatchError(e) {
|
|
3082
|
-
return new
|
|
3093
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3083
3094
|
}
|
|
3084
3095
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3085
3096
|
const root = rootCandidate.segments.length > 0 ?
|
|
@@ -3251,23 +3262,14 @@ class ApplyRedirects {
|
|
|
3251
3262
|
return of(true);
|
|
3252
3263
|
const canLoadObservables = canLoad.map((injectionToken) => {
|
|
3253
3264
|
const guard = injector.get(injectionToken);
|
|
3254
|
-
|
|
3255
|
-
if (isCanLoad(guard)) {
|
|
3256
|
-
guardVal = guard.canLoad(route, segments);
|
|
3257
|
-
}
|
|
3258
|
-
else if (isFunction(guard)) {
|
|
3259
|
-
guardVal = guard(route, segments);
|
|
3260
|
-
}
|
|
3261
|
-
else {
|
|
3262
|
-
throw new Error('Invalid CanLoad guard');
|
|
3263
|
-
}
|
|
3265
|
+
const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
|
|
3264
3266
|
return wrapIntoObservable(guardVal);
|
|
3265
3267
|
});
|
|
3266
3268
|
return of(canLoadObservables)
|
|
3267
3269
|
.pipe(prioritizedGuardValue(), tap((result) => {
|
|
3268
3270
|
if (!isUrlTree(result))
|
|
3269
3271
|
return;
|
|
3270
|
-
const error = navigationCancelingError(
|
|
3272
|
+
const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON + this.urlSerializer.serialize(result));
|
|
3271
3273
|
error.url = result;
|
|
3272
3274
|
throw error;
|
|
3273
3275
|
}), map(result => result === true));
|
|
@@ -3322,7 +3324,8 @@ class ApplyRedirects {
|
|
|
3322
3324
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3323
3325
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3324
3326
|
if (!pos)
|
|
3325
|
-
throw new
|
|
3327
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3328
|
+
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3326
3329
|
return pos;
|
|
3327
3330
|
}
|
|
3328
3331
|
findOrReturn(redirectToUrlSegment, actualSegments) {
|
|
@@ -3591,17 +3594,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
|
|
|
3591
3594
|
const canActivateObservables = canActivate.map((c) => {
|
|
3592
3595
|
return defer(() => {
|
|
3593
3596
|
const guard = getToken(c, futureARS, moduleInjector);
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
}
|
|
3598
|
-
else if (isFunction(guard)) {
|
|
3599
|
-
observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
|
3600
|
-
}
|
|
3601
|
-
else {
|
|
3602
|
-
throw new Error('Invalid CanActivate guard');
|
|
3603
|
-
}
|
|
3604
|
-
return observable.pipe(first());
|
|
3597
|
+
const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
|
|
3598
|
+
guard(futureARS, futureRSS);
|
|
3599
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3605
3600
|
});
|
|
3606
3601
|
});
|
|
3607
3602
|
return of(canActivateObservables).pipe(prioritizedGuardValue());
|
|
@@ -3616,17 +3611,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3616
3611
|
return defer(() => {
|
|
3617
3612
|
const guardsMapped = d.guards.map((c) => {
|
|
3618
3613
|
const guard = getToken(c, d.node, moduleInjector);
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
}
|
|
3623
|
-
else if (isFunction(guard)) {
|
|
3624
|
-
observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
|
3625
|
-
}
|
|
3626
|
-
else {
|
|
3627
|
-
throw new Error('Invalid CanActivateChild guard');
|
|
3628
|
-
}
|
|
3629
|
-
return observable.pipe(first());
|
|
3614
|
+
const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
|
|
3615
|
+
guard(futureARS, futureRSS);
|
|
3616
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3630
3617
|
});
|
|
3631
3618
|
return of(guardsMapped).pipe(prioritizedGuardValue());
|
|
3632
3619
|
});
|
|
@@ -3639,17 +3626,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3639
3626
|
return of(true);
|
|
3640
3627
|
const canDeactivateObservables = canDeactivate.map((c) => {
|
|
3641
3628
|
const guard = getToken(c, currARS, moduleInjector);
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
else if (isFunction(guard)) {
|
|
3647
|
-
observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
|
|
3648
|
-
}
|
|
3649
|
-
else {
|
|
3650
|
-
throw new Error('Invalid CanDeactivate guard');
|
|
3651
|
-
}
|
|
3652
|
-
return observable.pipe(first());
|
|
3629
|
+
const guardVal = isCanDeactivate(guard) ?
|
|
3630
|
+
guard.canDeactivate(component, currARS, currRSS, futureRSS) :
|
|
3631
|
+
guard(component, currARS, currRSS, futureRSS);
|
|
3632
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3653
3633
|
});
|
|
3654
3634
|
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
|
3655
3635
|
}
|
|
@@ -3661,7 +3641,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3661
3641
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3662
3642
|
* found in the LICENSE file at https://angular.io/license
|
|
3663
3643
|
*/
|
|
3664
|
-
const NG_DEV_MODE$
|
|
3644
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3665
3645
|
class NoMatch {
|
|
3666
3646
|
}
|
|
3667
3647
|
function newObservableError(e) {
|
|
@@ -3783,7 +3763,7 @@ class Recognizer {
|
|
|
3783
3763
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3784
3764
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3785
3765
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3786
|
-
(NG_DEV_MODE$
|
|
3766
|
+
(NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3787
3767
|
pathIndexShift));
|
|
3788
3768
|
}
|
|
3789
3769
|
else {
|
|
@@ -3794,7 +3774,7 @@ class Recognizer {
|
|
|
3794
3774
|
consumedSegments = result.consumedSegments;
|
|
3795
3775
|
remainingSegments = result.remainingSegments;
|
|
3796
3776
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
3797
|
-
snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_d = (_c = route.component) !== null && _c !== void 0 ? _c : route._loadedComponent) !== null && _d !== void 0 ? _d : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$
|
|
3777
|
+
snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_d = (_c = route.component) !== null && _c !== void 0 ? _c : route._loadedComponent) !== null && _d !== void 0 ? _d : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3798
3778
|
pathIndexShift));
|
|
3799
3779
|
}
|
|
3800
3780
|
const childConfig = getChildConfig(route);
|
|
@@ -3891,7 +3871,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
3891
3871
|
if (routeWithSameOutletName) {
|
|
3892
3872
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
3893
3873
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
3894
|
-
throw new
|
|
3874
|
+
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$3 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
|
|
3895
3875
|
}
|
|
3896
3876
|
names[n.value.outlet] = n.value;
|
|
3897
3877
|
});
|
|
@@ -4100,7 +4080,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4100
4080
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4101
4081
|
* found in the LICENSE file at https://angular.io/license
|
|
4102
4082
|
*/
|
|
4103
|
-
const NG_DEV_MODE$
|
|
4083
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4104
4084
|
/**
|
|
4105
4085
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4106
4086
|
*
|
|
@@ -4135,7 +4115,7 @@ class RouterConfigLoader {
|
|
|
4135
4115
|
if (this.onLoadEndListener) {
|
|
4136
4116
|
this.onLoadEndListener(route);
|
|
4137
4117
|
}
|
|
4138
|
-
NG_DEV_MODE$
|
|
4118
|
+
NG_DEV_MODE$2 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
|
|
4139
4119
|
route._loadedComponent = component;
|
|
4140
4120
|
}), finalize(() => {
|
|
4141
4121
|
this.componentLoaders.delete(route);
|
|
@@ -4178,7 +4158,7 @@ class RouterConfigLoader {
|
|
|
4178
4158
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4179
4159
|
}
|
|
4180
4160
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4181
|
-
NG_DEV_MODE$
|
|
4161
|
+
NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4182
4162
|
return { routes, injector };
|
|
4183
4163
|
}), finalize(() => {
|
|
4184
4164
|
this.childrenLoaders.delete(route);
|
|
@@ -4200,9 +4180,9 @@ class RouterConfigLoader {
|
|
|
4200
4180
|
}));
|
|
4201
4181
|
}
|
|
4202
4182
|
}
|
|
4203
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
4204
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
4205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
4183
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4184
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterConfigLoader });
|
|
4185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4206
4186
|
type: Injectable
|
|
4207
4187
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4208
4188
|
|
|
@@ -4237,7 +4217,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4237
4217
|
}
|
|
4238
4218
|
}
|
|
4239
4219
|
|
|
4240
|
-
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4220
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4241
4221
|
function defaultErrorHandler(error) {
|
|
4242
4222
|
throw error;
|
|
4243
4223
|
}
|
|
@@ -4290,6 +4270,7 @@ class Router {
|
|
|
4290
4270
|
this.lastSuccessfulNavigation = null;
|
|
4291
4271
|
this.currentNavigation = null;
|
|
4292
4272
|
this.disposed = false;
|
|
4273
|
+
/** @internal */
|
|
4293
4274
|
this.navigationId = 0;
|
|
4294
4275
|
/**
|
|
4295
4276
|
* The id of the currently active page in the router.
|
|
@@ -4551,7 +4532,8 @@ class Router {
|
|
|
4551
4532
|
this.triggerEvent(guardsStart);
|
|
4552
4533
|
}), map(t => (Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) }))), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
|
|
4553
4534
|
if (isUrlTree(t.guardsResult)) {
|
|
4554
|
-
const error = navigationCancelingError(
|
|
4535
|
+
const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON +
|
|
4536
|
+
`"${this.serializeUrl(t.guardsResult)}"`);
|
|
4555
4537
|
error.url = t.guardsResult;
|
|
4556
4538
|
throw error;
|
|
4557
4539
|
}
|
|
@@ -4588,7 +4570,7 @@ class Router {
|
|
|
4588
4570
|
}));
|
|
4589
4571
|
}
|
|
4590
4572
|
return undefined;
|
|
4591
|
-
}),
|
|
4573
|
+
}),
|
|
4592
4574
|
// --- LOAD COMPONENTS ---
|
|
4593
4575
|
switchTap((t) => {
|
|
4594
4576
|
const loadComponents = (route) => {
|
|
@@ -4608,7 +4590,7 @@ class Router {
|
|
|
4608
4590
|
};
|
|
4609
4591
|
return combineLatest(loadComponents(t.targetSnapshot.root))
|
|
4610
4592
|
.pipe(defaultIfEmpty(), take(1));
|
|
4611
|
-
}), map((t) => {
|
|
4593
|
+
}), switchTap(() => this.afterPreactivation()), map((t) => {
|
|
4612
4594
|
const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4613
4595
|
return (Object.assign(Object.assign({}, t), { targetRouterState }));
|
|
4614
4596
|
}),
|
|
@@ -4808,7 +4790,7 @@ class Router {
|
|
|
4808
4790
|
* ```
|
|
4809
4791
|
*/
|
|
4810
4792
|
resetConfig(config) {
|
|
4811
|
-
NG_DEV_MODE && validateConfig(config);
|
|
4793
|
+
NG_DEV_MODE$1 && validateConfig(config);
|
|
4812
4794
|
this.config = config.map(standardizeConfig);
|
|
4813
4795
|
this.navigated = false;
|
|
4814
4796
|
this.lastSuccessfulId = -1;
|
|
@@ -5166,16 +5148,16 @@ class Router {
|
|
|
5166
5148
|
return { navigationId };
|
|
5167
5149
|
}
|
|
5168
5150
|
}
|
|
5169
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5170
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5151
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5152
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: Router });
|
|
5153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: Router, decorators: [{
|
|
5172
5154
|
type: Injectable
|
|
5173
5155
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5174
5156
|
function validateCommands(commands) {
|
|
5175
5157
|
for (let i = 0; i < commands.length; i++) {
|
|
5176
5158
|
const cmd = commands[i];
|
|
5177
5159
|
if (cmd == null) {
|
|
5178
|
-
throw new
|
|
5160
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5179
5161
|
}
|
|
5180
5162
|
}
|
|
5181
5163
|
}
|
|
@@ -5360,9 +5342,9 @@ class RouterLink {
|
|
|
5360
5342
|
});
|
|
5361
5343
|
}
|
|
5362
5344
|
}
|
|
5363
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5364
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5365
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5345
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5346
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
5347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLink, decorators: [{
|
|
5366
5348
|
type: Directive,
|
|
5367
5349
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5368
5350
|
}], ctorParameters: function () {
|
|
@@ -5481,9 +5463,9 @@ class RouterLinkWithHref {
|
|
|
5481
5463
|
});
|
|
5482
5464
|
}
|
|
5483
5465
|
}
|
|
5484
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5485
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5486
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5466
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5467
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
|
|
5468
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5487
5469
|
type: Directive,
|
|
5488
5470
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5489
5471
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5710,9 +5692,9 @@ class RouterLinkActive {
|
|
|
5710
5692
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5711
5693
|
}
|
|
5712
5694
|
}
|
|
5713
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5714
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5715
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5695
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", 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 });
|
|
5696
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.5", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
5697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5716
5698
|
type: Directive,
|
|
5717
5699
|
args: [{
|
|
5718
5700
|
selector: '[routerLinkActive]',
|
|
@@ -5818,9 +5800,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
5818
5800
|
}
|
|
5819
5801
|
}
|
|
5820
5802
|
}
|
|
5821
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5822
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5823
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5803
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5804
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
5805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
5824
5806
|
type: Injectable,
|
|
5825
5807
|
args: [{ providedIn: 'root' }]
|
|
5826
5808
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -5857,6 +5839,12 @@ class PreloadAllModules {
|
|
|
5857
5839
|
return fn().pipe(catchError(() => of(null)));
|
|
5858
5840
|
}
|
|
5859
5841
|
}
|
|
5842
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5843
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
5844
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
5845
|
+
type: Injectable,
|
|
5846
|
+
args: [{ providedIn: 'root' }]
|
|
5847
|
+
}] });
|
|
5860
5848
|
/**
|
|
5861
5849
|
* @description
|
|
5862
5850
|
*
|
|
@@ -5871,6 +5859,12 @@ class NoPreloading {
|
|
|
5871
5859
|
return of(null);
|
|
5872
5860
|
}
|
|
5873
5861
|
}
|
|
5862
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5863
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
5864
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NoPreloading, decorators: [{
|
|
5865
|
+
type: Injectable,
|
|
5866
|
+
args: [{ providedIn: 'root' }]
|
|
5867
|
+
}] });
|
|
5874
5868
|
/**
|
|
5875
5869
|
* The preloader optimistically loads all router configurations to
|
|
5876
5870
|
* make navigations into lazily-loaded sections of the application faster.
|
|
@@ -5955,12 +5949,13 @@ class RouterPreloader {
|
|
|
5955
5949
|
});
|
|
5956
5950
|
}
|
|
5957
5951
|
}
|
|
5958
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5959
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5960
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5952
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5953
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterPreloader });
|
|
5954
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
5961
5955
|
type: Injectable
|
|
5962
5956
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
5963
5957
|
|
|
5958
|
+
const ROUTER_SCROLLER = new InjectionToken('');
|
|
5964
5959
|
class RouterScroller {
|
|
5965
5960
|
constructor(router,
|
|
5966
5961
|
/** @docsNotRequired */ viewportScroller, options = {}) {
|
|
@@ -6036,9 +6031,9 @@ class RouterScroller {
|
|
|
6036
6031
|
}
|
|
6037
6032
|
}
|
|
6038
6033
|
}
|
|
6039
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
6040
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
6041
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
6034
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6035
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterScroller });
|
|
6036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6042
6037
|
type: Injectable
|
|
6043
6038
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6044
6039
|
|
|
@@ -6049,6 +6044,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
6049
6044
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6050
6045
|
* found in the LICENSE file at https://angular.io/license
|
|
6051
6046
|
*/
|
|
6047
|
+
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6052
6048
|
/**
|
|
6053
6049
|
* The directives defined in the `RouterModule`.
|
|
6054
6050
|
*/
|
|
@@ -6058,11 +6054,15 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6058
6054
|
*
|
|
6059
6055
|
* @publicApi
|
|
6060
6056
|
*/
|
|
6061
|
-
const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION'
|
|
6057
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
|
|
6058
|
+
providedIn: 'root',
|
|
6059
|
+
factory: () => ({}),
|
|
6060
|
+
});
|
|
6062
6061
|
/**
|
|
6063
6062
|
* @docsNotRequired
|
|
6064
6063
|
*/
|
|
6065
|
-
const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
|
|
6064
|
+
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6065
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6066
6066
|
const ROUTER_PROVIDERS = [
|
|
6067
6067
|
Location,
|
|
6068
6068
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
@@ -6077,10 +6077,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6077
6077
|
},
|
|
6078
6078
|
ChildrenOutletContexts,
|
|
6079
6079
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6080
|
-
RouterPreloader,
|
|
6081
|
-
NoPreloading,
|
|
6082
|
-
PreloadAllModules,
|
|
6083
|
-
{ provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
|
|
6084
6080
|
RouterConfigLoader,
|
|
6085
6081
|
];
|
|
6086
6082
|
function routerNgProbeToken() {
|
|
@@ -6133,6 +6129,7 @@ class RouterModule {
|
|
|
6133
6129
|
ngModule: RouterModule,
|
|
6134
6130
|
providers: [
|
|
6135
6131
|
ROUTER_PROVIDERS,
|
|
6132
|
+
NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ? provideTracing() : []) : [],
|
|
6136
6133
|
provideRoutes(routes),
|
|
6137
6134
|
{
|
|
6138
6135
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6140,22 +6137,11 @@ class RouterModule {
|
|
|
6140
6137
|
deps: [[Router, new Optional(), new SkipSelf()]]
|
|
6141
6138
|
},
|
|
6142
6139
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION]
|
|
6147
|
-
},
|
|
6148
|
-
{
|
|
6149
|
-
provide: RouterScroller,
|
|
6150
|
-
useFactory: createRouterScroller,
|
|
6151
|
-
deps: [Router, ViewportScroller, ROUTER_CONFIGURATION]
|
|
6152
|
-
},
|
|
6153
|
-
{
|
|
6154
|
-
provide: PreloadingStrategy,
|
|
6155
|
-
useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
|
|
6156
|
-
NoPreloading
|
|
6157
|
-
},
|
|
6140
|
+
(config === null || config === void 0 ? void 0 : config.useHash) ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6141
|
+
provideRouterScroller(),
|
|
6142
|
+
(config === null || config === void 0 ? void 0 : config.preloadingStrategy) ? providePreloading(config.preloadingStrategy) : [],
|
|
6158
6143
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6144
|
+
(config === null || config === void 0 ? void 0 : config.initialNavigation) ? provideInitialNavigation(config) : [],
|
|
6159
6145
|
provideRouterInitializer(),
|
|
6160
6146
|
],
|
|
6161
6147
|
};
|
|
@@ -6180,10 +6166,10 @@ class RouterModule {
|
|
|
6180
6166
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6181
6167
|
}
|
|
6182
6168
|
}
|
|
6183
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
6184
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.
|
|
6185
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.
|
|
6186
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
6169
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6170
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.5", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6171
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterModule });
|
|
6172
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: RouterModule, decorators: [{
|
|
6187
6173
|
type: NgModule,
|
|
6188
6174
|
args: [{
|
|
6189
6175
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6199,19 +6185,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
6199
6185
|
type: Optional
|
|
6200
6186
|
}] }];
|
|
6201
6187
|
} });
|
|
6202
|
-
function
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6188
|
+
function provideRouterScroller() {
|
|
6189
|
+
return {
|
|
6190
|
+
provide: ROUTER_SCROLLER,
|
|
6191
|
+
useFactory: () => {
|
|
6192
|
+
const router = inject(Router);
|
|
6193
|
+
const viewportScroller = inject(ViewportScroller);
|
|
6194
|
+
const config = inject(ROUTER_CONFIGURATION);
|
|
6195
|
+
if (config.scrollOffset) {
|
|
6196
|
+
viewportScroller.setOffset(config.scrollOffset);
|
|
6197
|
+
}
|
|
6198
|
+
return new RouterScroller(router, viewportScroller, config);
|
|
6199
|
+
},
|
|
6200
|
+
};
|
|
6207
6201
|
}
|
|
6208
|
-
function
|
|
6209
|
-
return
|
|
6210
|
-
|
|
6202
|
+
function provideHashLocationStrategy() {
|
|
6203
|
+
return { provide: LocationStrategy, useClass: HashLocationStrategy };
|
|
6204
|
+
}
|
|
6205
|
+
function providePathLocationStrategy() {
|
|
6206
|
+
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6211
6207
|
}
|
|
6212
6208
|
function provideForRootGuard(router) {
|
|
6213
|
-
if (
|
|
6214
|
-
throw new
|
|
6209
|
+
if (NG_DEV_MODE && router) {
|
|
6210
|
+
throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6215
6211
|
}
|
|
6216
6212
|
return 'guarded';
|
|
6217
6213
|
}
|
|
@@ -6247,17 +6243,6 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
6247
6243
|
}
|
|
6248
6244
|
router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
|
|
6249
6245
|
assignExtraOptionsToRouter(opts, router);
|
|
6250
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && opts.enableTracing) {
|
|
6251
|
-
router.events.subscribe((e) => {
|
|
6252
|
-
var _a, _b;
|
|
6253
|
-
// tslint:disable:no-console
|
|
6254
|
-
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6255
|
-
console.log(stringifyEvent(e));
|
|
6256
|
-
console.log(e);
|
|
6257
|
-
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6258
|
-
// tslint:enable:no-console
|
|
6259
|
-
});
|
|
6260
|
-
}
|
|
6261
6246
|
return router;
|
|
6262
6247
|
}
|
|
6263
6248
|
function assignExtraOptionsToRouter(opts, router) {
|
|
@@ -6286,112 +6271,175 @@ function assignExtraOptionsToRouter(opts, router) {
|
|
|
6286
6271
|
function rootRoute(router) {
|
|
6287
6272
|
return router.routerState.root;
|
|
6288
6273
|
}
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
*
|
|
6295
|
-
* Next, we actually run activation in a `BOOTSTRAP_LISTENER`, using the
|
|
6296
|
-
* `afterPreactivation` hook provided by the router.
|
|
6297
|
-
* The router navigation starts, reaches the point when preactivation is done, and then
|
|
6298
|
-
* pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
|
|
6299
|
-
*/
|
|
6300
|
-
class RouterInitializer {
|
|
6301
|
-
constructor(injector) {
|
|
6302
|
-
this.injector = injector;
|
|
6303
|
-
this.initNavigation = false;
|
|
6304
|
-
this.destroyed = false;
|
|
6305
|
-
this.resultOfPreactivationDone = new Subject();
|
|
6306
|
-
}
|
|
6307
|
-
appInitializer() {
|
|
6308
|
-
const p = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6309
|
-
return p.then(() => {
|
|
6310
|
-
// If the injector was destroyed, the DI lookups below will fail.
|
|
6311
|
-
if (this.destroyed) {
|
|
6312
|
-
return Promise.resolve(true);
|
|
6313
|
-
}
|
|
6314
|
-
let resolve = null;
|
|
6315
|
-
const res = new Promise(r => resolve = r);
|
|
6316
|
-
const router = this.injector.get(Router);
|
|
6317
|
-
const opts = this.injector.get(ROUTER_CONFIGURATION);
|
|
6318
|
-
if (opts.initialNavigation === 'disabled') {
|
|
6319
|
-
router.setUpLocationChangeListener();
|
|
6320
|
-
resolve(true);
|
|
6321
|
-
}
|
|
6322
|
-
else if (opts.initialNavigation === 'enabledBlocking') {
|
|
6323
|
-
router.afterPreactivation = () => {
|
|
6324
|
-
// only the initial navigation should be delayed
|
|
6325
|
-
if (!this.initNavigation) {
|
|
6326
|
-
this.initNavigation = true;
|
|
6327
|
-
resolve(true);
|
|
6328
|
-
return this.resultOfPreactivationDone;
|
|
6329
|
-
// subsequent navigations should not be delayed
|
|
6330
|
-
}
|
|
6331
|
-
else {
|
|
6332
|
-
return of(void 0);
|
|
6333
|
-
}
|
|
6334
|
-
};
|
|
6335
|
-
router.initialNavigation();
|
|
6336
|
-
}
|
|
6337
|
-
else {
|
|
6338
|
-
resolve(true);
|
|
6339
|
-
}
|
|
6340
|
-
return res;
|
|
6341
|
-
});
|
|
6342
|
-
}
|
|
6343
|
-
bootstrapListener(bootstrappedComponentRef) {
|
|
6344
|
-
const opts = this.injector.get(ROUTER_CONFIGURATION);
|
|
6345
|
-
const preloader = this.injector.get(RouterPreloader);
|
|
6346
|
-
const routerScroller = this.injector.get(RouterScroller);
|
|
6347
|
-
const router = this.injector.get(Router);
|
|
6348
|
-
const ref = this.injector.get(ApplicationRef);
|
|
6274
|
+
function getBootstrapListener() {
|
|
6275
|
+
const injector = inject(Injector);
|
|
6276
|
+
return (bootstrappedComponentRef) => {
|
|
6277
|
+
var _a, _b;
|
|
6278
|
+
const ref = injector.get(ApplicationRef);
|
|
6349
6279
|
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6350
6280
|
return;
|
|
6351
6281
|
}
|
|
6282
|
+
const router = injector.get(Router);
|
|
6283
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6352
6284
|
// Default case
|
|
6353
|
-
if (
|
|
6285
|
+
if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
|
|
6354
6286
|
router.initialNavigation();
|
|
6355
6287
|
}
|
|
6356
|
-
|
|
6357
|
-
|
|
6288
|
+
(_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
|
|
6289
|
+
(_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
|
|
6358
6290
|
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
}
|
|
6362
|
-
ngOnDestroy() {
|
|
6363
|
-
this.destroyed = true;
|
|
6364
|
-
}
|
|
6365
|
-
}
|
|
6366
|
-
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6367
|
-
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterInitializer });
|
|
6368
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: RouterInitializer, decorators: [{
|
|
6369
|
-
type: Injectable
|
|
6370
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
6371
|
-
function getAppInitializer(r) {
|
|
6372
|
-
return r.appInitializer.bind(r);
|
|
6373
|
-
}
|
|
6374
|
-
function getBootstrapListener(r) {
|
|
6375
|
-
return r.bootstrapListener.bind(r);
|
|
6291
|
+
bootstrapDone.next();
|
|
6292
|
+
bootstrapDone.complete();
|
|
6293
|
+
};
|
|
6376
6294
|
}
|
|
6295
|
+
// TODO(atscott): This should not be in the public API
|
|
6377
6296
|
/**
|
|
6378
6297
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
6379
6298
|
* is called after the app is bootstrapped.
|
|
6380
6299
|
*
|
|
6381
6300
|
* @publicApi
|
|
6382
6301
|
*/
|
|
6383
|
-
const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
|
|
6302
|
+
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6303
|
+
function provideInitialNavigation(config) {
|
|
6304
|
+
return [
|
|
6305
|
+
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6306
|
+
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6307
|
+
];
|
|
6308
|
+
}
|
|
6384
6309
|
function provideRouterInitializer() {
|
|
6385
6310
|
return [
|
|
6386
|
-
|
|
6311
|
+
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
6312
|
+
// have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
|
|
6313
|
+
{ provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener },
|
|
6314
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6315
|
+
];
|
|
6316
|
+
}
|
|
6317
|
+
/**
|
|
6318
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6319
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6320
|
+
* to the activation phase.
|
|
6321
|
+
*/
|
|
6322
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6323
|
+
factory: () => {
|
|
6324
|
+
return new Subject();
|
|
6325
|
+
}
|
|
6326
|
+
});
|
|
6327
|
+
function provideEnabledBlockingInitialNavigation() {
|
|
6328
|
+
return [
|
|
6329
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
|
|
6387
6330
|
{
|
|
6388
6331
|
provide: APP_INITIALIZER,
|
|
6389
6332
|
multi: true,
|
|
6390
|
-
|
|
6391
|
-
|
|
6333
|
+
deps: [Injector],
|
|
6334
|
+
useFactory: (injector) => {
|
|
6335
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6336
|
+
let initNavigation = false;
|
|
6337
|
+
/**
|
|
6338
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6339
|
+
*
|
|
6340
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6341
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6342
|
+
*/
|
|
6343
|
+
function afterNextNavigation(action) {
|
|
6344
|
+
const router = injector.get(Router);
|
|
6345
|
+
router.events
|
|
6346
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6347
|
+
e instanceof NavigationError), map(e => {
|
|
6348
|
+
if (e instanceof NavigationEnd) {
|
|
6349
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6350
|
+
return true;
|
|
6351
|
+
}
|
|
6352
|
+
const newNavigationStarted = router.navigationId !== e.id;
|
|
6353
|
+
// TODO(atscott): Do not rely on the string reason to determine if cancelation
|
|
6354
|
+
// is redirecting
|
|
6355
|
+
const redirectingWithUrlTree = e instanceof NavigationCancel ?
|
|
6356
|
+
e.reason.indexOf(REDIRECTING_CANCELLATION_REASON) !== -1 :
|
|
6357
|
+
false;
|
|
6358
|
+
// Navigation failed, but if we already have a new navigation, wait for the
|
|
6359
|
+
// result of that one instead.
|
|
6360
|
+
return newNavigationStarted || redirectingWithUrlTree ? null : false;
|
|
6361
|
+
}), filter((result) => result !== null), take(1))
|
|
6362
|
+
.subscribe(() => {
|
|
6363
|
+
action();
|
|
6364
|
+
});
|
|
6365
|
+
}
|
|
6366
|
+
return () => {
|
|
6367
|
+
return locationInitialized.then(() => {
|
|
6368
|
+
return new Promise(resolve => {
|
|
6369
|
+
const router = injector.get(Router);
|
|
6370
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6371
|
+
afterNextNavigation(() => {
|
|
6372
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6373
|
+
// without a redirect.
|
|
6374
|
+
resolve(true);
|
|
6375
|
+
initNavigation = true;
|
|
6376
|
+
});
|
|
6377
|
+
router.afterPreactivation = () => {
|
|
6378
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6379
|
+
// assume activation will complete successfully (even though this is not
|
|
6380
|
+
// guaranteed).
|
|
6381
|
+
resolve(true);
|
|
6382
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6383
|
+
if (!initNavigation) {
|
|
6384
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6385
|
+
// subsequent navigations should not be delayed
|
|
6386
|
+
}
|
|
6387
|
+
else {
|
|
6388
|
+
return of(void 0);
|
|
6389
|
+
}
|
|
6390
|
+
};
|
|
6391
|
+
router.initialNavigation();
|
|
6392
|
+
});
|
|
6393
|
+
});
|
|
6394
|
+
};
|
|
6395
|
+
}
|
|
6392
6396
|
},
|
|
6393
|
-
|
|
6394
|
-
|
|
6397
|
+
];
|
|
6398
|
+
}
|
|
6399
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
|
|
6400
|
+
function provideDisabledInitialNavigation() {
|
|
6401
|
+
return [
|
|
6402
|
+
{
|
|
6403
|
+
provide: APP_INITIALIZER,
|
|
6404
|
+
multi: true,
|
|
6405
|
+
useFactory: () => {
|
|
6406
|
+
const router = inject(Router);
|
|
6407
|
+
return () => {
|
|
6408
|
+
router.setUpLocationChangeListener();
|
|
6409
|
+
};
|
|
6410
|
+
}
|
|
6411
|
+
},
|
|
6412
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'disabled' }
|
|
6413
|
+
];
|
|
6414
|
+
}
|
|
6415
|
+
function provideTracing() {
|
|
6416
|
+
if (NG_DEV_MODE) {
|
|
6417
|
+
return [{
|
|
6418
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6419
|
+
multi: true,
|
|
6420
|
+
useFactory: () => {
|
|
6421
|
+
const router = inject(Router);
|
|
6422
|
+
return () => router.events.subscribe((e) => {
|
|
6423
|
+
var _a, _b;
|
|
6424
|
+
// tslint:disable:no-console
|
|
6425
|
+
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6426
|
+
console.log(stringifyEvent(e));
|
|
6427
|
+
console.log(e);
|
|
6428
|
+
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6429
|
+
// tslint:enable:no-console
|
|
6430
|
+
});
|
|
6431
|
+
}
|
|
6432
|
+
}];
|
|
6433
|
+
}
|
|
6434
|
+
else {
|
|
6435
|
+
return [];
|
|
6436
|
+
}
|
|
6437
|
+
}
|
|
6438
|
+
function providePreloading(preloadingStrategy) {
|
|
6439
|
+
return [
|
|
6440
|
+
RouterPreloader,
|
|
6441
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6442
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6395
6443
|
];
|
|
6396
6444
|
}
|
|
6397
6445
|
|
|
@@ -6405,7 +6453,7 @@ function provideRouterInitializer() {
|
|
|
6405
6453
|
/**
|
|
6406
6454
|
* @publicApi
|
|
6407
6455
|
*/
|
|
6408
|
-
const VERSION = new Version('14.0.
|
|
6456
|
+
const VERSION = new Version('14.0.5');
|
|
6409
6457
|
|
|
6410
6458
|
/**
|
|
6411
6459
|
* @license
|
|
@@ -6444,5 +6492,5 @@ const VERSION = new Version('14.0.2');
|
|
|
6444
6492
|
* Generated bundle index. Do not edit.
|
|
6445
6493
|
*/
|
|
6446
6494
|
|
|
6447
|
-
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, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
|
|
6495
|
+
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, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
|
|
6448
6496
|
//# sourceMappingURL=router.mjs.map
|