@angular/router 14.1.0-next.2 → 14.1.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/apply_redirects.mjs +14 -8
- 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/events.mjs +22 -4
- package/esm2020/src/index.mjs +1 -1
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/navigation_canceling_error.mjs +32 -0
- package/esm2020/src/operators/check_guards.mjs +16 -49
- package/esm2020/src/operators/prioritized_guard_value.mjs +22 -27
- package/esm2020/src/page_title_strategy.mjs +3 -3
- package/esm2020/src/recognize.mjs +4 -3
- package/esm2020/src/router.mjs +27 -27
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +46 -12
- package/esm2020/src/router_preloader.mjs +9 -9
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/shared.mjs +1 -10
- package/esm2020/src/url_tree.mjs +9 -4
- package/esm2020/src/utils/config.mjs +17 -17
- package/esm2020/src/utils/type_guards.mjs +9 -5
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +4 -4
- package/fesm2015/router.mjs +241 -188
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +239 -188
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +77 -7
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2020/router.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.0-
|
|
2
|
+
* @license Angular v14.1.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, 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';
|
|
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, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import * as i3 from '@angular/common';
|
|
11
11
|
import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
|
|
12
|
-
import { map, switchMap, take, startWith,
|
|
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
|
|
|
15
15
|
/**
|
|
@@ -60,15 +60,6 @@ class ParamsAsMap {
|
|
|
60
60
|
function convertToParamMap(params) {
|
|
61
61
|
return new ParamsAsMap(params);
|
|
62
62
|
}
|
|
63
|
-
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
|
64
|
-
function navigationCancelingError(message) {
|
|
65
|
-
const error = Error('NavigationCancelingError: ' + message);
|
|
66
|
-
error[NAVIGATION_CANCELING_ERROR] = true;
|
|
67
|
-
return error;
|
|
68
|
-
}
|
|
69
|
-
function isNavigationCancelingError(error) {
|
|
70
|
-
return error && error[NAVIGATION_CANCELING_ERROR];
|
|
71
|
-
}
|
|
72
63
|
// Matches the route configuration (`route`) against the actual URL (`segments`).
|
|
73
64
|
function defaultUrlMatcher(segments, segmentGroup, route) {
|
|
74
65
|
const parts = route.path.split('/');
|
|
@@ -191,6 +182,7 @@ function wrapIntoObservable(value) {
|
|
|
191
182
|
* Use of this source code is governed by an MIT-style license that can be
|
|
192
183
|
* found in the LICENSE file at https://angular.io/license
|
|
193
184
|
*/
|
|
185
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
194
186
|
function createEmptyUrlTree() {
|
|
195
187
|
return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
|
|
196
188
|
}
|
|
@@ -655,7 +647,7 @@ class UrlParser {
|
|
|
655
647
|
parseSegment() {
|
|
656
648
|
const path = matchSegments(this.remaining);
|
|
657
649
|
if (path === '' && this.peekStartsWith(';')) {
|
|
658
|
-
throw new
|
|
650
|
+
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
|
|
659
651
|
}
|
|
660
652
|
this.capture(path);
|
|
661
653
|
return new UrlSegment(decode(path), this.parseMatrixParams());
|
|
@@ -724,7 +716,7 @@ class UrlParser {
|
|
|
724
716
|
// if is is not one of these characters, then the segment was unescaped
|
|
725
717
|
// or the group was not closed
|
|
726
718
|
if (next !== '/' && next !== ')' && next !== ';') {
|
|
727
|
-
throw new
|
|
719
|
+
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
|
|
728
720
|
}
|
|
729
721
|
let outletName = undefined;
|
|
730
722
|
if (path.indexOf(':') > -1) {
|
|
@@ -755,7 +747,7 @@ class UrlParser {
|
|
|
755
747
|
}
|
|
756
748
|
capture(str) {
|
|
757
749
|
if (!this.consumeOptional(str)) {
|
|
758
|
-
throw new
|
|
750
|
+
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
|
|
759
751
|
}
|
|
760
752
|
}
|
|
761
753
|
}
|
|
@@ -797,6 +789,9 @@ function mergeTrivialChildren(s) {
|
|
|
797
789
|
}
|
|
798
790
|
return s;
|
|
799
791
|
}
|
|
792
|
+
function isUrlTree(v) {
|
|
793
|
+
return v instanceof UrlTree;
|
|
794
|
+
}
|
|
800
795
|
|
|
801
796
|
/**
|
|
802
797
|
* @license
|
|
@@ -805,6 +800,7 @@ function mergeTrivialChildren(s) {
|
|
|
805
800
|
* Use of this source code is governed by an MIT-style license that can be
|
|
806
801
|
* found in the LICENSE file at https://angular.io/license
|
|
807
802
|
*/
|
|
803
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
808
804
|
/**
|
|
809
805
|
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
810
806
|
*
|
|
@@ -980,11 +976,11 @@ class Navigation {
|
|
|
980
976
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
981
977
|
this.commands = commands;
|
|
982
978
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
983
|
-
throw new
|
|
979
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
|
|
984
980
|
}
|
|
985
981
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
986
982
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
987
|
-
throw new
|
|
983
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
|
|
988
984
|
}
|
|
989
985
|
}
|
|
990
986
|
toRoot() {
|
|
@@ -1083,7 +1079,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1083
1079
|
dd -= ci;
|
|
1084
1080
|
g = g.parent;
|
|
1085
1081
|
if (!g) {
|
|
1086
|
-
throw new
|
|
1082
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
|
|
1087
1083
|
}
|
|
1088
1084
|
ci = g.segments.length;
|
|
1089
1085
|
}
|
|
@@ -1338,10 +1334,20 @@ class NavigationCancel extends RouterEvent {
|
|
|
1338
1334
|
id,
|
|
1339
1335
|
/** @docsNotRequired */
|
|
1340
1336
|
url,
|
|
1341
|
-
/**
|
|
1342
|
-
|
|
1337
|
+
/**
|
|
1338
|
+
* A description of why the navigation was cancelled. For debug purposes only. Use `code`
|
|
1339
|
+
* instead for a stable cancellation reason that can be used in production.
|
|
1340
|
+
*/
|
|
1341
|
+
reason,
|
|
1342
|
+
/**
|
|
1343
|
+
* A code to indicate why the navigation was canceled. This cancellation code is stable for
|
|
1344
|
+
* the reason and can be relied on whereas the `reason` string could change and should not be
|
|
1345
|
+
* used in production.
|
|
1346
|
+
*/
|
|
1347
|
+
code) {
|
|
1343
1348
|
super(id, url);
|
|
1344
1349
|
this.reason = reason;
|
|
1350
|
+
this.code = code;
|
|
1345
1351
|
this.type = 2 /* EventType.NavigationCancel */;
|
|
1346
1352
|
}
|
|
1347
1353
|
/** @docsNotRequired */
|
|
@@ -1365,9 +1371,17 @@ class NavigationError extends RouterEvent {
|
|
|
1365
1371
|
/** @docsNotRequired */
|
|
1366
1372
|
url,
|
|
1367
1373
|
/** @docsNotRequired */
|
|
1368
|
-
error
|
|
1374
|
+
error,
|
|
1375
|
+
/**
|
|
1376
|
+
* The target of the navigation when the error occurred.
|
|
1377
|
+
*
|
|
1378
|
+
* Note that this can be `undefined` because an error could have occurred before the
|
|
1379
|
+
* `RouterStateSnapshot` was created for the navigation.
|
|
1380
|
+
*/
|
|
1381
|
+
target) {
|
|
1369
1382
|
super(id, url);
|
|
1370
1383
|
this.error = error;
|
|
1384
|
+
this.target = target;
|
|
1371
1385
|
this.type = 3 /* EventType.NavigationError */;
|
|
1372
1386
|
}
|
|
1373
1387
|
/** @docsNotRequired */
|
|
@@ -2229,6 +2243,37 @@ function createActivatedRoute(c) {
|
|
|
2229
2243
|
return new ActivatedRoute(new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c);
|
|
2230
2244
|
}
|
|
2231
2245
|
|
|
2246
|
+
/**
|
|
2247
|
+
* @license
|
|
2248
|
+
* Copyright Google LLC All Rights Reserved.
|
|
2249
|
+
*
|
|
2250
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
2251
|
+
* found in the LICENSE file at https://angular.io/license
|
|
2252
|
+
*/
|
|
2253
|
+
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
|
2254
|
+
function redirectingNavigationError(urlSerializer, redirect) {
|
|
2255
|
+
const { redirectTo, navigationBehaviorOptions } = isUrlTree(redirect) ? { redirectTo: redirect, navigationBehaviorOptions: undefined } : redirect;
|
|
2256
|
+
const error = navigationCancelingError(ngDevMode && `Redirecting to "${urlSerializer.serialize(redirectTo)}"`, 0 /* NavigationCancellationCode.Redirect */, redirect);
|
|
2257
|
+
error.url = redirectTo;
|
|
2258
|
+
error.navigationBehaviorOptions = navigationBehaviorOptions;
|
|
2259
|
+
return error;
|
|
2260
|
+
}
|
|
2261
|
+
function navigationCancelingError(message, code, redirectUrl) {
|
|
2262
|
+
const error = new Error('NavigationCancelingError: ' + (message || ''));
|
|
2263
|
+
error[NAVIGATION_CANCELING_ERROR] = true;
|
|
2264
|
+
error.cancellationCode = code;
|
|
2265
|
+
if (redirectUrl) {
|
|
2266
|
+
error.url = redirectUrl;
|
|
2267
|
+
}
|
|
2268
|
+
return error;
|
|
2269
|
+
}
|
|
2270
|
+
function isRedirectingNavigationCancelingError$1(error) {
|
|
2271
|
+
return isNavigationCancelingError$1(error) && isUrlTree(error.url);
|
|
2272
|
+
}
|
|
2273
|
+
function isNavigationCancelingError$1(error) {
|
|
2274
|
+
return error && error[NAVIGATION_CANCELING_ERROR];
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2232
2277
|
/**
|
|
2233
2278
|
* @license
|
|
2234
2279
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -2315,6 +2360,7 @@ class ChildrenOutletContexts {
|
|
|
2315
2360
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2316
2361
|
* found in the LICENSE file at https://angular.io/license
|
|
2317
2362
|
*/
|
|
2363
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2318
2364
|
/**
|
|
2319
2365
|
* @description
|
|
2320
2366
|
*
|
|
@@ -2391,7 +2437,10 @@ class RouterOutlet {
|
|
|
2391
2437
|
}
|
|
2392
2438
|
/** @nodoc */
|
|
2393
2439
|
ngOnDestroy() {
|
|
2394
|
-
this.
|
|
2440
|
+
// Ensure that the registered outlet is this one before removing it on the context.
|
|
2441
|
+
if (this.parentContexts.getContext(this.name)?.outlet === this) {
|
|
2442
|
+
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
2443
|
+
}
|
|
2395
2444
|
}
|
|
2396
2445
|
/** @nodoc */
|
|
2397
2446
|
ngOnInit() {
|
|
@@ -2420,12 +2469,12 @@ class RouterOutlet {
|
|
|
2420
2469
|
*/
|
|
2421
2470
|
get component() {
|
|
2422
2471
|
if (!this.activated)
|
|
2423
|
-
throw new
|
|
2472
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2424
2473
|
return this.activated.instance;
|
|
2425
2474
|
}
|
|
2426
2475
|
get activatedRoute() {
|
|
2427
2476
|
if (!this.activated)
|
|
2428
|
-
throw new
|
|
2477
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2429
2478
|
return this._activatedRoute;
|
|
2430
2479
|
}
|
|
2431
2480
|
get activatedRouteData() {
|
|
@@ -2439,7 +2488,7 @@ class RouterOutlet {
|
|
|
2439
2488
|
*/
|
|
2440
2489
|
detach() {
|
|
2441
2490
|
if (!this.activated)
|
|
2442
|
-
throw new
|
|
2491
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2443
2492
|
this.location.detach();
|
|
2444
2493
|
const cmp = this.activated;
|
|
2445
2494
|
this.activated = null;
|
|
@@ -2467,7 +2516,7 @@ class RouterOutlet {
|
|
|
2467
2516
|
}
|
|
2468
2517
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2469
2518
|
if (this.isActivated) {
|
|
2470
|
-
throw new
|
|
2519
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
|
|
2471
2520
|
}
|
|
2472
2521
|
this._activatedRoute = activatedRoute;
|
|
2473
2522
|
const location = this.location;
|
|
@@ -2489,9 +2538,9 @@ class RouterOutlet {
|
|
|
2489
2538
|
this.activateEvents.emit(this.activated.instance);
|
|
2490
2539
|
}
|
|
2491
2540
|
}
|
|
2492
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
2493
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-
|
|
2494
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
2541
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
|
|
2542
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2543
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2495
2544
|
type: Directive,
|
|
2496
2545
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2497
2546
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
@@ -2548,9 +2597,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2548
2597
|
*/
|
|
2549
2598
|
class ɵEmptyOutletComponent {
|
|
2550
2599
|
}
|
|
2551
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
2552
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-
|
|
2553
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
2600
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2601
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2554
2603
|
type: Component,
|
|
2555
2604
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2556
2605
|
}] });
|
|
@@ -2599,13 +2648,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
|
|
|
2599
2648
|
}
|
|
2600
2649
|
function assertStandalone(fullPath, component) {
|
|
2601
2650
|
if (component && !ɵisStandalone(component)) {
|
|
2602
|
-
throw new
|
|
2651
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
|
|
2603
2652
|
}
|
|
2604
2653
|
}
|
|
2605
2654
|
function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
2606
2655
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2607
2656
|
if (!route) {
|
|
2608
|
-
throw new
|
|
2657
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
|
|
2609
2658
|
Invalid configuration of route '${fullPath}': Encountered undefined route.
|
|
2610
2659
|
The reason might be an extra comma.
|
|
2611
2660
|
|
|
@@ -2618,47 +2667,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
|
2618
2667
|
`);
|
|
2619
2668
|
}
|
|
2620
2669
|
if (Array.isArray(route)) {
|
|
2621
|
-
throw new
|
|
2670
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
|
|
2622
2671
|
}
|
|
2623
2672
|
if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
|
|
2624
2673
|
(route.outlet && route.outlet !== PRIMARY_OUTLET)) {
|
|
2625
|
-
throw new
|
|
2674
|
+
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`);
|
|
2626
2675
|
}
|
|
2627
2676
|
if (route.redirectTo && route.children) {
|
|
2628
|
-
throw new
|
|
2677
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
|
|
2629
2678
|
}
|
|
2630
2679
|
if (route.redirectTo && route.loadChildren) {
|
|
2631
|
-
throw new
|
|
2680
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
|
|
2632
2681
|
}
|
|
2633
2682
|
if (route.children && route.loadChildren) {
|
|
2634
|
-
throw new
|
|
2683
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
|
|
2635
2684
|
}
|
|
2636
2685
|
if (route.redirectTo && (route.component || route.loadComponent)) {
|
|
2637
|
-
throw new
|
|
2686
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
|
|
2638
2687
|
}
|
|
2639
2688
|
if (route.component && route.loadComponent) {
|
|
2640
|
-
throw new
|
|
2689
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
|
|
2641
2690
|
}
|
|
2642
2691
|
if (route.redirectTo && route.canActivate) {
|
|
2643
|
-
throw new
|
|
2692
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
|
|
2644
2693
|
`so canActivate will never be executed.`);
|
|
2645
2694
|
}
|
|
2646
2695
|
if (route.path && route.matcher) {
|
|
2647
|
-
throw new
|
|
2696
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
|
|
2648
2697
|
}
|
|
2649
2698
|
if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
|
|
2650
2699
|
!route.children && !route.loadChildren) {
|
|
2651
|
-
throw new
|
|
2700
|
+
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`);
|
|
2652
2701
|
}
|
|
2653
2702
|
if (route.path === void 0 && route.matcher === void 0) {
|
|
2654
|
-
throw new
|
|
2703
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
|
|
2655
2704
|
}
|
|
2656
2705
|
if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
|
|
2657
|
-
throw new
|
|
2706
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
|
|
2658
2707
|
}
|
|
2659
2708
|
if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
|
|
2660
2709
|
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
|
|
2661
|
-
throw new
|
|
2710
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
|
2662
2711
|
}
|
|
2663
2712
|
if (requireStandaloneComponents) {
|
|
2664
2713
|
assertStandalone(fullPath, route.component);
|
|
@@ -3086,9 +3135,6 @@ function isFunction(v) {
|
|
|
3086
3135
|
function isBoolean(v) {
|
|
3087
3136
|
return typeof v === 'boolean';
|
|
3088
3137
|
}
|
|
3089
|
-
function isUrlTree(v) {
|
|
3090
|
-
return v instanceof UrlTree;
|
|
3091
|
-
}
|
|
3092
3138
|
function isCanLoad(guard) {
|
|
3093
3139
|
return guard && isFunction(guard.canLoad);
|
|
3094
3140
|
}
|
|
@@ -3104,6 +3150,12 @@ function isCanDeactivate(guard) {
|
|
|
3104
3150
|
function isCanMatch(guard) {
|
|
3105
3151
|
return guard && isFunction(guard.canMatch);
|
|
3106
3152
|
}
|
|
3153
|
+
function isRedirectingNavigationCancelingError(error) {
|
|
3154
|
+
return isNavigationCancelingError(error) && isUrlTree(error.url);
|
|
3155
|
+
}
|
|
3156
|
+
function isNavigationCancelingError(error) {
|
|
3157
|
+
return error && error[NAVIGATION_CANCELING_ERROR];
|
|
3158
|
+
}
|
|
3107
3159
|
|
|
3108
3160
|
/**
|
|
3109
3161
|
* @license
|
|
@@ -3116,31 +3168,26 @@ const INITIAL_VALUE = Symbol('INITIAL_VALUE');
|
|
|
3116
3168
|
function prioritizedGuardValue() {
|
|
3117
3169
|
return switchMap(obs => {
|
|
3118
3170
|
return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE))))
|
|
3119
|
-
.pipe(
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
if (
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
// call. This guarantees that in the case of a guard at the bottom of the
|
|
3129
|
-
// tree that returns a redirect, we will wait for the higher priority
|
|
3130
|
-
// guard at the top to finish before performing the redirect.
|
|
3131
|
-
if (!isPending) {
|
|
3132
|
-
// Early return when we hit a `false` value as that should always
|
|
3133
|
-
// cancel navigation
|
|
3134
|
-
if (val === false)
|
|
3135
|
-
return val;
|
|
3136
|
-
if (i === list.length - 1 || isUrlTree(val)) {
|
|
3137
|
-
return val;
|
|
3138
|
-
}
|
|
3171
|
+
.pipe(map((results) => {
|
|
3172
|
+
for (const result of results) {
|
|
3173
|
+
if (result === true) {
|
|
3174
|
+
// If result is true, check the next one
|
|
3175
|
+
continue;
|
|
3176
|
+
}
|
|
3177
|
+
else if (result === INITIAL_VALUE) {
|
|
3178
|
+
// If guard has not finished, we need to stop processing.
|
|
3179
|
+
return INITIAL_VALUE;
|
|
3139
3180
|
}
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3181
|
+
else if (result === false || result instanceof UrlTree) {
|
|
3182
|
+
// Result finished and was not true. Return the result.
|
|
3183
|
+
// Note that we only allow false/UrlTree. Other values are considered invalid and
|
|
3184
|
+
// ignored.
|
|
3185
|
+
return result;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
// Everything resolved to true. Return true.
|
|
3189
|
+
return true;
|
|
3190
|
+
}), filter((item) => item !== INITIAL_VALUE), take(1));
|
|
3144
3191
|
});
|
|
3145
3192
|
}
|
|
3146
3193
|
|
|
@@ -3212,17 +3259,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
|
|
|
3212
3259
|
const canActivateObservables = canActivate.map((c) => {
|
|
3213
3260
|
return defer(() => {
|
|
3214
3261
|
const guard = getToken(c, futureARS, moduleInjector);
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
}
|
|
3219
|
-
else if (isFunction(guard)) {
|
|
3220
|
-
observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
|
3221
|
-
}
|
|
3222
|
-
else {
|
|
3223
|
-
throw new Error('Invalid CanActivate guard');
|
|
3224
|
-
}
|
|
3225
|
-
return observable.pipe(first());
|
|
3262
|
+
const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
|
|
3263
|
+
guard(futureARS, futureRSS);
|
|
3264
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3226
3265
|
});
|
|
3227
3266
|
});
|
|
3228
3267
|
return of(canActivateObservables).pipe(prioritizedGuardValue());
|
|
@@ -3237,17 +3276,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3237
3276
|
return defer(() => {
|
|
3238
3277
|
const guardsMapped = d.guards.map((c) => {
|
|
3239
3278
|
const guard = getToken(c, d.node, moduleInjector);
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
}
|
|
3244
|
-
else if (isFunction(guard)) {
|
|
3245
|
-
observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
|
3246
|
-
}
|
|
3247
|
-
else {
|
|
3248
|
-
throw new Error('Invalid CanActivateChild guard');
|
|
3249
|
-
}
|
|
3250
|
-
return observable.pipe(first());
|
|
3279
|
+
const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
|
|
3280
|
+
guard(futureARS, futureRSS);
|
|
3281
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3251
3282
|
});
|
|
3252
3283
|
return of(guardsMapped).pipe(prioritizedGuardValue());
|
|
3253
3284
|
});
|
|
@@ -3260,17 +3291,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3260
3291
|
return of(true);
|
|
3261
3292
|
const canDeactivateObservables = canDeactivate.map((c) => {
|
|
3262
3293
|
const guard = getToken(c, currARS, moduleInjector);
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
else if (isFunction(guard)) {
|
|
3268
|
-
observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
|
|
3269
|
-
}
|
|
3270
|
-
else {
|
|
3271
|
-
throw new Error('Invalid CanDeactivate guard');
|
|
3272
|
-
}
|
|
3273
|
-
return observable.pipe(first());
|
|
3294
|
+
const guardVal = isCanDeactivate(guard) ?
|
|
3295
|
+
guard.canDeactivate(component, currARS, currRSS, futureRSS) :
|
|
3296
|
+
guard(component, currARS, currRSS, futureRSS);
|
|
3297
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3274
3298
|
});
|
|
3275
3299
|
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
|
3276
3300
|
}
|
|
@@ -3281,16 +3305,7 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
|
|
|
3281
3305
|
}
|
|
3282
3306
|
const canLoadObservables = canLoad.map((injectionToken) => {
|
|
3283
3307
|
const guard = injector.get(injectionToken);
|
|
3284
|
-
|
|
3285
|
-
if (isCanLoad(guard)) {
|
|
3286
|
-
guardVal = guard.canLoad(route, segments);
|
|
3287
|
-
}
|
|
3288
|
-
else if (isFunction(guard)) {
|
|
3289
|
-
guardVal = guard(route, segments);
|
|
3290
|
-
}
|
|
3291
|
-
else {
|
|
3292
|
-
throw new Error('Invalid CanLoad guard');
|
|
3293
|
-
}
|
|
3308
|
+
const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
|
|
3294
3309
|
return wrapIntoObservable(guardVal);
|
|
3295
3310
|
});
|
|
3296
3311
|
return of(canLoadObservables)
|
|
@@ -3300,9 +3315,7 @@ function redirectIfUrlTree(urlSerializer) {
|
|
|
3300
3315
|
return pipe(tap((result) => {
|
|
3301
3316
|
if (!isUrlTree(result))
|
|
3302
3317
|
return;
|
|
3303
|
-
|
|
3304
|
-
error.url = result;
|
|
3305
|
-
throw error;
|
|
3318
|
+
throw redirectingNavigationError(urlSerializer, result);
|
|
3306
3319
|
}), map(result => result === true));
|
|
3307
3320
|
}
|
|
3308
3321
|
function runCanMatchGuards(injector, route, segments, urlSerializer) {
|
|
@@ -3480,6 +3493,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3480
3493
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3481
3494
|
* found in the LICENSE file at https://angular.io/license
|
|
3482
3495
|
*/
|
|
3496
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3483
3497
|
class NoMatch$1 {
|
|
3484
3498
|
constructor(segmentGroup) {
|
|
3485
3499
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3497,10 +3511,12 @@ function absoluteRedirect(newTree) {
|
|
|
3497
3511
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3498
3512
|
}
|
|
3499
3513
|
function namedOutletsRedirect(redirectTo) {
|
|
3500
|
-
return throwError(new
|
|
3514
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3515
|
+
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3501
3516
|
}
|
|
3502
3517
|
function canLoadFails(route) {
|
|
3503
|
-
return throwError(navigationCancelingError(
|
|
3518
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
|
|
3519
|
+
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3504
3520
|
}
|
|
3505
3521
|
/**
|
|
3506
3522
|
* Returns the `UrlTree` with the redirection applied.
|
|
@@ -3559,7 +3575,7 @@ class ApplyRedirects {
|
|
|
3559
3575
|
}));
|
|
3560
3576
|
}
|
|
3561
3577
|
noMatchError(e) {
|
|
3562
|
-
return new
|
|
3578
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3563
3579
|
}
|
|
3564
3580
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3565
3581
|
const root = createRoot(rootCandidate);
|
|
@@ -3739,9 +3755,9 @@ class ApplyRedirects {
|
|
|
3739
3755
|
}
|
|
3740
3756
|
}
|
|
3741
3757
|
applyRedirectCommands(segments, redirectTo, posParams) {
|
|
3742
|
-
return this.
|
|
3758
|
+
return this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
|
|
3743
3759
|
}
|
|
3744
|
-
|
|
3760
|
+
applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
|
|
3745
3761
|
const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
|
|
3746
3762
|
return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
|
|
3747
3763
|
}
|
|
@@ -3774,7 +3790,8 @@ class ApplyRedirects {
|
|
|
3774
3790
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3775
3791
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3776
3792
|
if (!pos)
|
|
3777
|
-
throw new
|
|
3793
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3794
|
+
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3778
3795
|
return pos;
|
|
3779
3796
|
}
|
|
3780
3797
|
findOrReturn(redirectToUrlSegment, actualSegments) {
|
|
@@ -3898,7 +3915,7 @@ class Recognizer {
|
|
|
3898
3915
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3899
3916
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3900
3917
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3901
|
-
if (
|
|
3918
|
+
if (NG_DEV_MODE$3) {
|
|
3902
3919
|
// This should really never happen - we are only taking the first match for each
|
|
3903
3920
|
// outlet and merge the empty path matches.
|
|
3904
3921
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -4060,7 +4077,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4060
4077
|
if (routeWithSameOutletName) {
|
|
4061
4078
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4062
4079
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4063
|
-
throw new
|
|
4080
|
+
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}'.`);
|
|
4064
4081
|
}
|
|
4065
4082
|
names[n.value.outlet] = n.value;
|
|
4066
4083
|
});
|
|
@@ -4366,9 +4383,9 @@ class RouterConfigLoader {
|
|
|
4366
4383
|
}));
|
|
4367
4384
|
}
|
|
4368
4385
|
}
|
|
4369
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
4370
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-
|
|
4371
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
4386
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4387
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader });
|
|
4388
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4372
4389
|
type: Injectable
|
|
4373
4390
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4374
4391
|
|
|
@@ -4735,16 +4752,14 @@ class Router {
|
|
|
4735
4752
|
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
|
|
4736
4753
|
})), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
|
|
4737
4754
|
if (isUrlTree(t.guardsResult)) {
|
|
4738
|
-
|
|
4739
|
-
error.url = t.guardsResult;
|
|
4740
|
-
throw error;
|
|
4755
|
+
throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
|
|
4741
4756
|
}
|
|
4742
4757
|
const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
|
|
4743
4758
|
this.triggerEvent(guardsEnd);
|
|
4744
4759
|
}), filter(t => {
|
|
4745
4760
|
if (!t.guardsResult) {
|
|
4746
4761
|
this.restoreHistory(t);
|
|
4747
|
-
this.cancelNavigationTransition(t, '');
|
|
4762
|
+
this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
|
|
4748
4763
|
return false;
|
|
4749
4764
|
}
|
|
4750
4765
|
return true;
|
|
@@ -4762,7 +4777,9 @@ class Router {
|
|
|
4762
4777
|
complete: () => {
|
|
4763
4778
|
if (!dataResolved) {
|
|
4764
4779
|
this.restoreHistory(t);
|
|
4765
|
-
this.cancelNavigationTransition(t,
|
|
4780
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
|
|
4781
|
+
`At least one route resolver didn't emit any value.` :
|
|
4782
|
+
'', 2 /* NavigationCancellationCode.NoDataFromResolver */);
|
|
4766
4783
|
}
|
|
4767
4784
|
}
|
|
4768
4785
|
}));
|
|
@@ -4772,7 +4789,7 @@ class Router {
|
|
|
4772
4789
|
}));
|
|
4773
4790
|
}
|
|
4774
4791
|
return undefined;
|
|
4775
|
-
}),
|
|
4792
|
+
}),
|
|
4776
4793
|
// --- LOAD COMPONENTS ---
|
|
4777
4794
|
switchTap((t) => {
|
|
4778
4795
|
const loadComponents = (route) => {
|
|
@@ -4791,11 +4808,11 @@ class Router {
|
|
|
4791
4808
|
};
|
|
4792
4809
|
return combineLatest(loadComponents(t.targetSnapshot.root))
|
|
4793
4810
|
.pipe(defaultIfEmpty(), take(1));
|
|
4794
|
-
}), map((t) => {
|
|
4811
|
+
}), switchTap(() => this.afterPreactivation()), map((t) => {
|
|
4795
4812
|
const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4796
4813
|
return ({ ...t, targetRouterState });
|
|
4797
4814
|
}),
|
|
4798
|
-
/* Once here, we are about to activate
|
|
4815
|
+
/* Once here, we are about to activate synchronously. The assumption is this
|
|
4799
4816
|
will succeed, and user code may read from the Router service. Therefore
|
|
4800
4817
|
before activation, we need to update router properties storing the current
|
|
4801
4818
|
URL and the RouterState, as well as updated the browser URL. All this should
|
|
@@ -4827,8 +4844,10 @@ class Router {
|
|
|
4827
4844
|
* event is fired when a navigation gets cancelled but not caught by other
|
|
4828
4845
|
* means. */
|
|
4829
4846
|
if (!completed && !errored) {
|
|
4830
|
-
const cancelationReason =
|
|
4831
|
-
|
|
4847
|
+
const cancelationReason = NG_DEV_MODE$1 ?
|
|
4848
|
+
`Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
4849
|
+
'';
|
|
4850
|
+
this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
|
|
4832
4851
|
}
|
|
4833
4852
|
// Only clear current navigation if it is still set to the one that
|
|
4834
4853
|
// finalized.
|
|
@@ -4850,9 +4869,8 @@ class Router {
|
|
|
4850
4869
|
errored = true;
|
|
4851
4870
|
/* This error type is issued during Redirect, and is handled as a
|
|
4852
4871
|
* cancellation rather than an error. */
|
|
4853
|
-
if (isNavigationCancelingError(e)) {
|
|
4854
|
-
|
|
4855
|
-
if (!redirecting) {
|
|
4872
|
+
if (isNavigationCancelingError$1(e)) {
|
|
4873
|
+
if (!isRedirectingNavigationCancelingError$1(e)) {
|
|
4856
4874
|
// Set property only if we're not redirecting. If we landed on a page and
|
|
4857
4875
|
// redirect to `/` route, the new navigation is going to see the `/`
|
|
4858
4876
|
// isn't a change from the default currentUrlTree and won't navigate.
|
|
@@ -4861,11 +4879,11 @@ class Router {
|
|
|
4861
4879
|
this.navigated = true;
|
|
4862
4880
|
this.restoreHistory(t, true);
|
|
4863
4881
|
}
|
|
4864
|
-
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message);
|
|
4882
|
+
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, e.cancellationCode);
|
|
4865
4883
|
eventsSubject.next(navCancel);
|
|
4866
4884
|
// When redirecting, we need to delay resolving the navigation
|
|
4867
4885
|
// promise and push it to the redirect navigation
|
|
4868
|
-
if (!
|
|
4886
|
+
if (!isRedirectingNavigationCancelingError$1(e)) {
|
|
4869
4887
|
t.resolve(false);
|
|
4870
4888
|
}
|
|
4871
4889
|
else {
|
|
@@ -4886,7 +4904,7 @@ class Router {
|
|
|
4886
4904
|
}
|
|
4887
4905
|
else {
|
|
4888
4906
|
this.restoreHistory(t, true);
|
|
4889
|
-
const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e);
|
|
4907
|
+
const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e, t.targetSnapshot ?? undefined);
|
|
4890
4908
|
eventsSubject.next(navError);
|
|
4891
4909
|
try {
|
|
4892
4910
|
t.resolve(this.errorHandler(e));
|
|
@@ -5286,7 +5304,7 @@ class Router {
|
|
|
5286
5304
|
// The navigator change the location before triggered the browser event,
|
|
5287
5305
|
// so we need to go back to the current url if the navigation is canceled.
|
|
5288
5306
|
// Also, when navigation gets cancelled while using url update strategy eager, then we need to
|
|
5289
|
-
// go back. Because, when `
|
|
5307
|
+
// go back. Because, when `urlUpdateStrategy` is `eager`; `setBrowserUrl` method is called
|
|
5290
5308
|
// before any verification.
|
|
5291
5309
|
const browserUrlUpdateOccurred = (t.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
|
|
5292
5310
|
this.currentUrlTree === this.currentNavigation?.finalUrl);
|
|
@@ -5332,8 +5350,8 @@ class Router {
|
|
|
5332
5350
|
resetUrlToCurrentUrlTree() {
|
|
5333
5351
|
this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
|
|
5334
5352
|
}
|
|
5335
|
-
cancelNavigationTransition(t, reason) {
|
|
5336
|
-
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason);
|
|
5353
|
+
cancelNavigationTransition(t, reason, code) {
|
|
5354
|
+
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
|
|
5337
5355
|
this.triggerEvent(navCancel);
|
|
5338
5356
|
t.resolve(false);
|
|
5339
5357
|
}
|
|
@@ -5344,16 +5362,16 @@ class Router {
|
|
|
5344
5362
|
return { navigationId };
|
|
5345
5363
|
}
|
|
5346
5364
|
}
|
|
5347
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
5348
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-
|
|
5349
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
5365
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5366
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router });
|
|
5367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router, decorators: [{
|
|
5350
5368
|
type: Injectable
|
|
5351
5369
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5352
5370
|
function validateCommands(commands) {
|
|
5353
5371
|
for (let i = 0; i < commands.length; i++) {
|
|
5354
5372
|
const cmd = commands[i];
|
|
5355
5373
|
if (cmd == null) {
|
|
5356
|
-
throw new
|
|
5374
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5357
5375
|
}
|
|
5358
5376
|
}
|
|
5359
5377
|
}
|
|
@@ -5545,9 +5563,9 @@ class RouterLink {
|
|
|
5545
5563
|
});
|
|
5546
5564
|
}
|
|
5547
5565
|
}
|
|
5548
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
5549
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-
|
|
5550
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
5566
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
|
|
5567
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", 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 });
|
|
5568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLink, decorators: [{
|
|
5551
5569
|
type: Directive,
|
|
5552
5570
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5553
5571
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
@@ -5664,9 +5682,9 @@ class RouterLinkWithHref {
|
|
|
5664
5682
|
});
|
|
5665
5683
|
}
|
|
5666
5684
|
}
|
|
5667
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
5668
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-
|
|
5669
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
5685
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5686
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", 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 });
|
|
5687
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5670
5688
|
type: Directive,
|
|
5671
5689
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5672
5690
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5891,9 +5909,9 @@ class RouterLinkActive {
|
|
|
5891
5909
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5892
5910
|
}
|
|
5893
5911
|
}
|
|
5894
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
5895
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-
|
|
5896
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
5912
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
|
|
5913
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", 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 });
|
|
5914
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5897
5915
|
type: Directive,
|
|
5898
5916
|
args: [{
|
|
5899
5917
|
selector: '[routerLinkActive]',
|
|
@@ -5996,9 +6014,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
5996
6014
|
}
|
|
5997
6015
|
}
|
|
5998
6016
|
}
|
|
5999
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
6000
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-
|
|
6001
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
6017
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6018
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
6019
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
6002
6020
|
type: Injectable,
|
|
6003
6021
|
args: [{ providedIn: 'root' }]
|
|
6004
6022
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -6035,9 +6053,9 @@ class PreloadAllModules {
|
|
|
6035
6053
|
return fn().pipe(catchError(() => of(null)));
|
|
6036
6054
|
}
|
|
6037
6055
|
}
|
|
6038
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
6039
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-
|
|
6040
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
6056
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6057
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6058
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6041
6059
|
type: Injectable,
|
|
6042
6060
|
args: [{ providedIn: 'root' }]
|
|
6043
6061
|
}] });
|
|
@@ -6055,9 +6073,9 @@ class NoPreloading {
|
|
|
6055
6073
|
return of(null);
|
|
6056
6074
|
}
|
|
6057
6075
|
}
|
|
6058
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
6059
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-
|
|
6060
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
6076
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6077
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6061
6079
|
type: Injectable,
|
|
6062
6080
|
args: [{ providedIn: 'root' }]
|
|
6063
6081
|
}] });
|
|
@@ -6143,9 +6161,9 @@ class RouterPreloader {
|
|
|
6143
6161
|
});
|
|
6144
6162
|
}
|
|
6145
6163
|
}
|
|
6146
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
6147
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-
|
|
6148
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
6164
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6165
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader });
|
|
6166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6149
6167
|
type: Injectable
|
|
6150
6168
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6151
6169
|
|
|
@@ -6232,9 +6250,9 @@ class RouterScroller {
|
|
|
6232
6250
|
}
|
|
6233
6251
|
}
|
|
6234
6252
|
}
|
|
6235
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
6236
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-
|
|
6237
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
6253
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6254
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller });
|
|
6255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6238
6256
|
type: Injectable
|
|
6239
6257
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6240
6258
|
|
|
@@ -6367,10 +6385,10 @@ class RouterModule {
|
|
|
6367
6385
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6368
6386
|
}
|
|
6369
6387
|
}
|
|
6370
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-
|
|
6371
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-
|
|
6372
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-
|
|
6373
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-
|
|
6388
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6389
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6390
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule });
|
|
6391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, decorators: [{
|
|
6374
6392
|
type: NgModule,
|
|
6375
6393
|
args: [{
|
|
6376
6394
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6406,7 +6424,7 @@ function providePathLocationStrategy() {
|
|
|
6406
6424
|
}
|
|
6407
6425
|
function provideForRootGuard(router) {
|
|
6408
6426
|
if (NG_DEV_MODE && router) {
|
|
6409
|
-
throw new
|
|
6427
|
+
throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6410
6428
|
}
|
|
6411
6429
|
return 'guarded';
|
|
6412
6430
|
}
|
|
@@ -6532,17 +6550,50 @@ function provideEnabledBlockingInitialNavigation() {
|
|
|
6532
6550
|
useFactory: (injector) => {
|
|
6533
6551
|
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6534
6552
|
let initNavigation = false;
|
|
6553
|
+
/**
|
|
6554
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6555
|
+
*
|
|
6556
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6557
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6558
|
+
*/
|
|
6559
|
+
function afterNextNavigation(action) {
|
|
6560
|
+
const router = injector.get(Router);
|
|
6561
|
+
router.events
|
|
6562
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6563
|
+
e instanceof NavigationError), map(e => {
|
|
6564
|
+
if (e instanceof NavigationEnd) {
|
|
6565
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6566
|
+
return true;
|
|
6567
|
+
}
|
|
6568
|
+
const redirecting = e instanceof NavigationCancel ?
|
|
6569
|
+
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6570
|
+
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6571
|
+
false;
|
|
6572
|
+
return redirecting ? null : false;
|
|
6573
|
+
}), filter((result) => result !== null), take(1))
|
|
6574
|
+
.subscribe(() => {
|
|
6575
|
+
action();
|
|
6576
|
+
});
|
|
6577
|
+
}
|
|
6535
6578
|
return () => {
|
|
6536
6579
|
return locationInitialized.then(() => {
|
|
6537
6580
|
return new Promise(resolve => {
|
|
6538
6581
|
const router = injector.get(Router);
|
|
6539
6582
|
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6583
|
+
afterNextNavigation(() => {
|
|
6584
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6585
|
+
// without a redirect.
|
|
6586
|
+
resolve(true);
|
|
6587
|
+
initNavigation = true;
|
|
6588
|
+
});
|
|
6540
6589
|
router.afterPreactivation = () => {
|
|
6541
|
-
//
|
|
6590
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6591
|
+
// assume activation will complete successfully (even though this is not
|
|
6592
|
+
// guaranteed).
|
|
6593
|
+
resolve(true);
|
|
6594
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6542
6595
|
if (!initNavigation) {
|
|
6543
|
-
|
|
6544
|
-
resolve(true);
|
|
6545
|
-
return bootstrapDone;
|
|
6596
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6546
6597
|
// subsequent navigations should not be delayed
|
|
6547
6598
|
}
|
|
6548
6599
|
else {
|
|
@@ -6613,7 +6664,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6613
6664
|
/**
|
|
6614
6665
|
* @publicApi
|
|
6615
6666
|
*/
|
|
6616
|
-
const VERSION = new Version('14.1.0-
|
|
6667
|
+
const VERSION = new Version('14.1.0-rc.0');
|
|
6617
6668
|
|
|
6618
6669
|
/**
|
|
6619
6670
|
* @license
|