@angular/router 14.1.0-next.3 → 14.1.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 +10 -9
- 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/operators/recognize.mjs +1 -1
- package/esm2020/src/page_title_strategy.mjs +11 -5
- package/esm2020/src/recognize.mjs +4 -3
- package/esm2020/src/router.mjs +88 -85
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +52 -18
- 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 +10 -12
- package/fesm2015/router.mjs +304 -246
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +10 -12
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +307 -250
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +10 -12
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +79 -7
- package/package.json +4 -4
- package/testing/index.d.ts +2 -3
- package/upgrade/index.d.ts +1 -1
package/fesm2015/router.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.0
|
|
2
|
+
* @license Angular v14.1.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,
|
|
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, inject, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, 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
|
-
import { map, switchMap, take, startWith,
|
|
10
|
+
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';
|
|
11
11
|
import * as i3 from '@angular/common';
|
|
12
12
|
import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
|
|
13
13
|
import * as i1 from '@angular/platform-browser';
|
|
@@ -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
|
*
|
|
@@ -982,11 +978,11 @@ class Navigation {
|
|
|
982
978
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
983
979
|
this.commands = commands;
|
|
984
980
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
985
|
-
throw new
|
|
981
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
|
|
986
982
|
}
|
|
987
983
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
988
984
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
989
|
-
throw new
|
|
985
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
|
|
990
986
|
}
|
|
991
987
|
}
|
|
992
988
|
toRoot() {
|
|
@@ -1085,7 +1081,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1085
1081
|
dd -= ci;
|
|
1086
1082
|
g = g.parent;
|
|
1087
1083
|
if (!g) {
|
|
1088
|
-
throw new
|
|
1084
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
|
|
1089
1085
|
}
|
|
1090
1086
|
ci = g.segments.length;
|
|
1091
1087
|
}
|
|
@@ -1340,10 +1336,20 @@ class NavigationCancel extends RouterEvent {
|
|
|
1340
1336
|
id,
|
|
1341
1337
|
/** @docsNotRequired */
|
|
1342
1338
|
url,
|
|
1343
|
-
/**
|
|
1344
|
-
|
|
1339
|
+
/**
|
|
1340
|
+
* A description of why the navigation was cancelled. For debug purposes only. Use `code`
|
|
1341
|
+
* instead for a stable cancellation reason that can be used in production.
|
|
1342
|
+
*/
|
|
1343
|
+
reason,
|
|
1344
|
+
/**
|
|
1345
|
+
* A code to indicate why the navigation was canceled. This cancellation code is stable for
|
|
1346
|
+
* the reason and can be relied on whereas the `reason` string could change and should not be
|
|
1347
|
+
* used in production.
|
|
1348
|
+
*/
|
|
1349
|
+
code) {
|
|
1345
1350
|
super(id, url);
|
|
1346
1351
|
this.reason = reason;
|
|
1352
|
+
this.code = code;
|
|
1347
1353
|
this.type = 2 /* EventType.NavigationCancel */;
|
|
1348
1354
|
}
|
|
1349
1355
|
/** @docsNotRequired */
|
|
@@ -1367,9 +1373,17 @@ class NavigationError extends RouterEvent {
|
|
|
1367
1373
|
/** @docsNotRequired */
|
|
1368
1374
|
url,
|
|
1369
1375
|
/** @docsNotRequired */
|
|
1370
|
-
error
|
|
1376
|
+
error,
|
|
1377
|
+
/**
|
|
1378
|
+
* The target of the navigation when the error occurred.
|
|
1379
|
+
*
|
|
1380
|
+
* Note that this can be `undefined` because an error could have occurred before the
|
|
1381
|
+
* `RouterStateSnapshot` was created for the navigation.
|
|
1382
|
+
*/
|
|
1383
|
+
target) {
|
|
1371
1384
|
super(id, url);
|
|
1372
1385
|
this.error = error;
|
|
1386
|
+
this.target = target;
|
|
1373
1387
|
this.type = 3 /* EventType.NavigationError */;
|
|
1374
1388
|
}
|
|
1375
1389
|
/** @docsNotRequired */
|
|
@@ -2233,6 +2247,37 @@ function createActivatedRoute(c) {
|
|
|
2233
2247
|
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);
|
|
2234
2248
|
}
|
|
2235
2249
|
|
|
2250
|
+
/**
|
|
2251
|
+
* @license
|
|
2252
|
+
* Copyright Google LLC All Rights Reserved.
|
|
2253
|
+
*
|
|
2254
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
2255
|
+
* found in the LICENSE file at https://angular.io/license
|
|
2256
|
+
*/
|
|
2257
|
+
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
|
2258
|
+
function redirectingNavigationError(urlSerializer, redirect) {
|
|
2259
|
+
const { redirectTo, navigationBehaviorOptions } = isUrlTree(redirect) ? { redirectTo: redirect, navigationBehaviorOptions: undefined } : redirect;
|
|
2260
|
+
const error = navigationCancelingError(ngDevMode && `Redirecting to "${urlSerializer.serialize(redirectTo)}"`, 0 /* NavigationCancellationCode.Redirect */, redirect);
|
|
2261
|
+
error.url = redirectTo;
|
|
2262
|
+
error.navigationBehaviorOptions = navigationBehaviorOptions;
|
|
2263
|
+
return error;
|
|
2264
|
+
}
|
|
2265
|
+
function navigationCancelingError(message, code, redirectUrl) {
|
|
2266
|
+
const error = new Error('NavigationCancelingError: ' + (message || ''));
|
|
2267
|
+
error[NAVIGATION_CANCELING_ERROR] = true;
|
|
2268
|
+
error.cancellationCode = code;
|
|
2269
|
+
if (redirectUrl) {
|
|
2270
|
+
error.url = redirectUrl;
|
|
2271
|
+
}
|
|
2272
|
+
return error;
|
|
2273
|
+
}
|
|
2274
|
+
function isRedirectingNavigationCancelingError$1(error) {
|
|
2275
|
+
return isNavigationCancelingError$1(error) && isUrlTree(error.url);
|
|
2276
|
+
}
|
|
2277
|
+
function isNavigationCancelingError$1(error) {
|
|
2278
|
+
return error && error[NAVIGATION_CANCELING_ERROR];
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2236
2281
|
/**
|
|
2237
2282
|
* @license
|
|
2238
2283
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -2319,6 +2364,7 @@ class ChildrenOutletContexts {
|
|
|
2319
2364
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2320
2365
|
* found in the LICENSE file at https://angular.io/license
|
|
2321
2366
|
*/
|
|
2367
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2322
2368
|
/**
|
|
2323
2369
|
* @description
|
|
2324
2370
|
*
|
|
@@ -2428,12 +2474,12 @@ class RouterOutlet {
|
|
|
2428
2474
|
*/
|
|
2429
2475
|
get component() {
|
|
2430
2476
|
if (!this.activated)
|
|
2431
|
-
throw new
|
|
2477
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2432
2478
|
return this.activated.instance;
|
|
2433
2479
|
}
|
|
2434
2480
|
get activatedRoute() {
|
|
2435
2481
|
if (!this.activated)
|
|
2436
|
-
throw new
|
|
2482
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2437
2483
|
return this._activatedRoute;
|
|
2438
2484
|
}
|
|
2439
2485
|
get activatedRouteData() {
|
|
@@ -2447,7 +2493,7 @@ class RouterOutlet {
|
|
|
2447
2493
|
*/
|
|
2448
2494
|
detach() {
|
|
2449
2495
|
if (!this.activated)
|
|
2450
|
-
throw new
|
|
2496
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2451
2497
|
this.location.detach();
|
|
2452
2498
|
const cmp = this.activated;
|
|
2453
2499
|
this.activated = null;
|
|
@@ -2475,7 +2521,7 @@ class RouterOutlet {
|
|
|
2475
2521
|
}
|
|
2476
2522
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2477
2523
|
if (this.isActivated) {
|
|
2478
|
-
throw new
|
|
2524
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
|
|
2479
2525
|
}
|
|
2480
2526
|
this._activatedRoute = activatedRoute;
|
|
2481
2527
|
const location = this.location;
|
|
@@ -2497,9 +2543,9 @@ class RouterOutlet {
|
|
|
2497
2543
|
this.activateEvents.emit(this.activated.instance);
|
|
2498
2544
|
}
|
|
2499
2545
|
}
|
|
2500
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
2501
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0
|
|
2502
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
2546
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
|
|
2547
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2503
2549
|
type: Directive,
|
|
2504
2550
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2505
2551
|
}], ctorParameters: function () {
|
|
@@ -2558,9 +2604,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2558
2604
|
*/
|
|
2559
2605
|
class ɵEmptyOutletComponent {
|
|
2560
2606
|
}
|
|
2561
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
2562
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0
|
|
2563
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
2607
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2608
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.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"] }] });
|
|
2609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2564
2610
|
type: Component,
|
|
2565
2611
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2566
2612
|
}] });
|
|
@@ -2610,13 +2656,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
|
|
|
2610
2656
|
}
|
|
2611
2657
|
function assertStandalone(fullPath, component) {
|
|
2612
2658
|
if (component && !ɵisStandalone(component)) {
|
|
2613
|
-
throw new
|
|
2659
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
|
|
2614
2660
|
}
|
|
2615
2661
|
}
|
|
2616
2662
|
function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
2617
2663
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2618
2664
|
if (!route) {
|
|
2619
|
-
throw new
|
|
2665
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
|
|
2620
2666
|
Invalid configuration of route '${fullPath}': Encountered undefined route.
|
|
2621
2667
|
The reason might be an extra comma.
|
|
2622
2668
|
|
|
@@ -2629,47 +2675,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
|
2629
2675
|
`);
|
|
2630
2676
|
}
|
|
2631
2677
|
if (Array.isArray(route)) {
|
|
2632
|
-
throw new
|
|
2678
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
|
|
2633
2679
|
}
|
|
2634
2680
|
if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
|
|
2635
2681
|
(route.outlet && route.outlet !== PRIMARY_OUTLET)) {
|
|
2636
|
-
throw new
|
|
2682
|
+
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`);
|
|
2637
2683
|
}
|
|
2638
2684
|
if (route.redirectTo && route.children) {
|
|
2639
|
-
throw new
|
|
2685
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
|
|
2640
2686
|
}
|
|
2641
2687
|
if (route.redirectTo && route.loadChildren) {
|
|
2642
|
-
throw new
|
|
2688
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
|
|
2643
2689
|
}
|
|
2644
2690
|
if (route.children && route.loadChildren) {
|
|
2645
|
-
throw new
|
|
2691
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
|
|
2646
2692
|
}
|
|
2647
2693
|
if (route.redirectTo && (route.component || route.loadComponent)) {
|
|
2648
|
-
throw new
|
|
2694
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
|
|
2649
2695
|
}
|
|
2650
2696
|
if (route.component && route.loadComponent) {
|
|
2651
|
-
throw new
|
|
2697
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
|
|
2652
2698
|
}
|
|
2653
2699
|
if (route.redirectTo && route.canActivate) {
|
|
2654
|
-
throw new
|
|
2700
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
|
|
2655
2701
|
`so canActivate will never be executed.`);
|
|
2656
2702
|
}
|
|
2657
2703
|
if (route.path && route.matcher) {
|
|
2658
|
-
throw new
|
|
2704
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
|
|
2659
2705
|
}
|
|
2660
2706
|
if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
|
|
2661
2707
|
!route.children && !route.loadChildren) {
|
|
2662
|
-
throw new
|
|
2708
|
+
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`);
|
|
2663
2709
|
}
|
|
2664
2710
|
if (route.path === void 0 && route.matcher === void 0) {
|
|
2665
|
-
throw new
|
|
2711
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
|
|
2666
2712
|
}
|
|
2667
2713
|
if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
|
|
2668
|
-
throw new
|
|
2714
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
|
|
2669
2715
|
}
|
|
2670
2716
|
if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
|
|
2671
2717
|
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
|
|
2672
|
-
throw new
|
|
2718
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
|
2673
2719
|
}
|
|
2674
2720
|
if (requireStandaloneComponents) {
|
|
2675
2721
|
assertStandalone(fullPath, route.component);
|
|
@@ -3099,9 +3145,6 @@ function isFunction(v) {
|
|
|
3099
3145
|
function isBoolean(v) {
|
|
3100
3146
|
return typeof v === 'boolean';
|
|
3101
3147
|
}
|
|
3102
|
-
function isUrlTree(v) {
|
|
3103
|
-
return v instanceof UrlTree;
|
|
3104
|
-
}
|
|
3105
3148
|
function isCanLoad(guard) {
|
|
3106
3149
|
return guard && isFunction(guard.canLoad);
|
|
3107
3150
|
}
|
|
@@ -3117,6 +3160,12 @@ function isCanDeactivate(guard) {
|
|
|
3117
3160
|
function isCanMatch(guard) {
|
|
3118
3161
|
return guard && isFunction(guard.canMatch);
|
|
3119
3162
|
}
|
|
3163
|
+
function isRedirectingNavigationCancelingError(error) {
|
|
3164
|
+
return isNavigationCancelingError(error) && isUrlTree(error.url);
|
|
3165
|
+
}
|
|
3166
|
+
function isNavigationCancelingError(error) {
|
|
3167
|
+
return error && error[NAVIGATION_CANCELING_ERROR];
|
|
3168
|
+
}
|
|
3120
3169
|
|
|
3121
3170
|
/**
|
|
3122
3171
|
* @license
|
|
@@ -3129,31 +3178,26 @@ const INITIAL_VALUE = Symbol('INITIAL_VALUE');
|
|
|
3129
3178
|
function prioritizedGuardValue() {
|
|
3130
3179
|
return switchMap(obs => {
|
|
3131
3180
|
return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE))))
|
|
3132
|
-
.pipe(
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
if (
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
// call. This guarantees that in the case of a guard at the bottom of the
|
|
3142
|
-
// tree that returns a redirect, we will wait for the higher priority
|
|
3143
|
-
// guard at the top to finish before performing the redirect.
|
|
3144
|
-
if (!isPending) {
|
|
3145
|
-
// Early return when we hit a `false` value as that should always
|
|
3146
|
-
// cancel navigation
|
|
3147
|
-
if (val === false)
|
|
3148
|
-
return val;
|
|
3149
|
-
if (i === list.length - 1 || isUrlTree(val)) {
|
|
3150
|
-
return val;
|
|
3151
|
-
}
|
|
3181
|
+
.pipe(map((results) => {
|
|
3182
|
+
for (const result of results) {
|
|
3183
|
+
if (result === true) {
|
|
3184
|
+
// If result is true, check the next one
|
|
3185
|
+
continue;
|
|
3186
|
+
}
|
|
3187
|
+
else if (result === INITIAL_VALUE) {
|
|
3188
|
+
// If guard has not finished, we need to stop processing.
|
|
3189
|
+
return INITIAL_VALUE;
|
|
3152
3190
|
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3191
|
+
else if (result === false || result instanceof UrlTree) {
|
|
3192
|
+
// Result finished and was not true. Return the result.
|
|
3193
|
+
// Note that we only allow false/UrlTree. Other values are considered invalid and
|
|
3194
|
+
// ignored.
|
|
3195
|
+
return result;
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
// Everything resolved to true. Return true.
|
|
3199
|
+
return true;
|
|
3200
|
+
}), filter((item) => item !== INITIAL_VALUE), take(1));
|
|
3157
3201
|
});
|
|
3158
3202
|
}
|
|
3159
3203
|
|
|
@@ -3225,17 +3269,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
|
|
|
3225
3269
|
const canActivateObservables = canActivate.map((c) => {
|
|
3226
3270
|
return defer(() => {
|
|
3227
3271
|
const guard = getToken(c, futureARS, moduleInjector);
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
}
|
|
3232
|
-
else if (isFunction(guard)) {
|
|
3233
|
-
observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
|
3234
|
-
}
|
|
3235
|
-
else {
|
|
3236
|
-
throw new Error('Invalid CanActivate guard');
|
|
3237
|
-
}
|
|
3238
|
-
return observable.pipe(first());
|
|
3272
|
+
const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
|
|
3273
|
+
guard(futureARS, futureRSS);
|
|
3274
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3239
3275
|
});
|
|
3240
3276
|
});
|
|
3241
3277
|
return of(canActivateObservables).pipe(prioritizedGuardValue());
|
|
@@ -3250,17 +3286,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3250
3286
|
return defer(() => {
|
|
3251
3287
|
const guardsMapped = d.guards.map((c) => {
|
|
3252
3288
|
const guard = getToken(c, d.node, moduleInjector);
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
}
|
|
3257
|
-
else if (isFunction(guard)) {
|
|
3258
|
-
observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
|
3259
|
-
}
|
|
3260
|
-
else {
|
|
3261
|
-
throw new Error('Invalid CanActivateChild guard');
|
|
3262
|
-
}
|
|
3263
|
-
return observable.pipe(first());
|
|
3289
|
+
const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
|
|
3290
|
+
guard(futureARS, futureRSS);
|
|
3291
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3264
3292
|
});
|
|
3265
3293
|
return of(guardsMapped).pipe(prioritizedGuardValue());
|
|
3266
3294
|
});
|
|
@@ -3273,17 +3301,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3273
3301
|
return of(true);
|
|
3274
3302
|
const canDeactivateObservables = canDeactivate.map((c) => {
|
|
3275
3303
|
const guard = getToken(c, currARS, moduleInjector);
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
else if (isFunction(guard)) {
|
|
3281
|
-
observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
|
|
3282
|
-
}
|
|
3283
|
-
else {
|
|
3284
|
-
throw new Error('Invalid CanDeactivate guard');
|
|
3285
|
-
}
|
|
3286
|
-
return observable.pipe(first());
|
|
3304
|
+
const guardVal = isCanDeactivate(guard) ?
|
|
3305
|
+
guard.canDeactivate(component, currARS, currRSS, futureRSS) :
|
|
3306
|
+
guard(component, currARS, currRSS, futureRSS);
|
|
3307
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3287
3308
|
});
|
|
3288
3309
|
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
|
3289
3310
|
}
|
|
@@ -3294,16 +3315,7 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
|
|
|
3294
3315
|
}
|
|
3295
3316
|
const canLoadObservables = canLoad.map((injectionToken) => {
|
|
3296
3317
|
const guard = injector.get(injectionToken);
|
|
3297
|
-
|
|
3298
|
-
if (isCanLoad(guard)) {
|
|
3299
|
-
guardVal = guard.canLoad(route, segments);
|
|
3300
|
-
}
|
|
3301
|
-
else if (isFunction(guard)) {
|
|
3302
|
-
guardVal = guard(route, segments);
|
|
3303
|
-
}
|
|
3304
|
-
else {
|
|
3305
|
-
throw new Error('Invalid CanLoad guard');
|
|
3306
|
-
}
|
|
3318
|
+
const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
|
|
3307
3319
|
return wrapIntoObservable(guardVal);
|
|
3308
3320
|
});
|
|
3309
3321
|
return of(canLoadObservables)
|
|
@@ -3313,9 +3325,7 @@ function redirectIfUrlTree(urlSerializer) {
|
|
|
3313
3325
|
return pipe(tap((result) => {
|
|
3314
3326
|
if (!isUrlTree(result))
|
|
3315
3327
|
return;
|
|
3316
|
-
|
|
3317
|
-
error.url = result;
|
|
3318
|
-
throw error;
|
|
3328
|
+
throw redirectingNavigationError(urlSerializer, result);
|
|
3319
3329
|
}), map(result => result === true));
|
|
3320
3330
|
}
|
|
3321
3331
|
function runCanMatchGuards(injector, route, segments, urlSerializer) {
|
|
@@ -3493,6 +3503,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3493
3503
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3494
3504
|
* found in the LICENSE file at https://angular.io/license
|
|
3495
3505
|
*/
|
|
3506
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3496
3507
|
class NoMatch$1 {
|
|
3497
3508
|
constructor(segmentGroup) {
|
|
3498
3509
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3510,10 +3521,12 @@ function absoluteRedirect(newTree) {
|
|
|
3510
3521
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3511
3522
|
}
|
|
3512
3523
|
function namedOutletsRedirect(redirectTo) {
|
|
3513
|
-
return throwError(new
|
|
3524
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3525
|
+
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3514
3526
|
}
|
|
3515
3527
|
function canLoadFails(route) {
|
|
3516
|
-
return throwError(navigationCancelingError(
|
|
3528
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
|
|
3529
|
+
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3517
3530
|
}
|
|
3518
3531
|
/**
|
|
3519
3532
|
* Returns the `UrlTree` with the redirection applied.
|
|
@@ -3572,7 +3585,7 @@ class ApplyRedirects {
|
|
|
3572
3585
|
}));
|
|
3573
3586
|
}
|
|
3574
3587
|
noMatchError(e) {
|
|
3575
|
-
return new
|
|
3588
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3576
3589
|
}
|
|
3577
3590
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3578
3591
|
const root = createRoot(rootCandidate);
|
|
@@ -3754,9 +3767,9 @@ class ApplyRedirects {
|
|
|
3754
3767
|
}
|
|
3755
3768
|
}
|
|
3756
3769
|
applyRedirectCommands(segments, redirectTo, posParams) {
|
|
3757
|
-
return this.
|
|
3770
|
+
return this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
|
|
3758
3771
|
}
|
|
3759
|
-
|
|
3772
|
+
applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
|
|
3760
3773
|
const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
|
|
3761
3774
|
return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
|
|
3762
3775
|
}
|
|
@@ -3789,7 +3802,8 @@ class ApplyRedirects {
|
|
|
3789
3802
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3790
3803
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3791
3804
|
if (!pos)
|
|
3792
|
-
throw new
|
|
3805
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3806
|
+
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3793
3807
|
return pos;
|
|
3794
3808
|
}
|
|
3795
3809
|
findOrReturn(redirectToUrlSegment, actualSegments) {
|
|
@@ -3913,7 +3927,7 @@ class Recognizer {
|
|
|
3913
3927
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3914
3928
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3915
3929
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3916
|
-
if (
|
|
3930
|
+
if (NG_DEV_MODE$3) {
|
|
3917
3931
|
// This should really never happen - we are only taking the first match for each
|
|
3918
3932
|
// outlet and merge the empty path matches.
|
|
3919
3933
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -4079,7 +4093,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4079
4093
|
if (routeWithSameOutletName) {
|
|
4080
4094
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4081
4095
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4082
|
-
throw new
|
|
4096
|
+
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}'.`);
|
|
4083
4097
|
}
|
|
4084
4098
|
names[n.value.outlet] = n.value;
|
|
4085
4099
|
});
|
|
@@ -4388,9 +4402,9 @@ class RouterConfigLoader {
|
|
|
4388
4402
|
}));
|
|
4389
4403
|
}
|
|
4390
4404
|
}
|
|
4391
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
4392
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0
|
|
4393
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
4405
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4406
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader });
|
|
4407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4394
4408
|
type: Injectable
|
|
4395
4409
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4396
4410
|
|
|
@@ -4641,10 +4655,11 @@ class Router {
|
|
|
4641
4655
|
// Extract URL
|
|
4642
4656
|
map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))),
|
|
4643
4657
|
// Using switchMap so we cancel executing navigations when a new one comes in
|
|
4644
|
-
switchMap(
|
|
4658
|
+
switchMap(overallTransitionState => {
|
|
4645
4659
|
let completed = false;
|
|
4646
4660
|
let errored = false;
|
|
4647
|
-
return of(
|
|
4661
|
+
return of(overallTransitionState)
|
|
4662
|
+
.pipe(
|
|
4648
4663
|
// Store the Navigation object
|
|
4649
4664
|
tap(t => {
|
|
4650
4665
|
this.currentNavigation = {
|
|
@@ -4662,8 +4677,8 @@ class Router {
|
|
|
4662
4677
|
t.extractedUrl.toString() !== browserUrlTree ||
|
|
4663
4678
|
// Navigations which succeed or ones which fail and are cleaned up
|
|
4664
4679
|
// correctly should result in `browserUrlTree` and `currentUrlTree`
|
|
4665
|
-
// matching. If this is not the case, assume something went wrong and
|
|
4666
|
-
// processing the URL again.
|
|
4680
|
+
// matching. If this is not the case, assume something went wrong and
|
|
4681
|
+
// try processing the URL again.
|
|
4667
4682
|
browserUrlTree !== this.currentUrlTree.toString();
|
|
4668
4683
|
const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
|
|
4669
4684
|
this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
|
|
@@ -4691,11 +4706,13 @@ class Router {
|
|
|
4691
4706
|
// `urlAfterRedirects` is guaranteed to be set after this point
|
|
4692
4707
|
tap(t => {
|
|
4693
4708
|
this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
|
|
4709
|
+
overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
|
|
4694
4710
|
}),
|
|
4695
4711
|
// Recognize
|
|
4696
4712
|
recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy, this.relativeLinkResolution),
|
|
4697
4713
|
// Update URL if in `eager` update mode
|
|
4698
4714
|
tap(t => {
|
|
4715
|
+
overallTransitionState.targetSnapshot = t.targetSnapshot;
|
|
4699
4716
|
if (this.urlUpdateStrategy === 'eager') {
|
|
4700
4717
|
if (!t.extras.skipLocationChange) {
|
|
4701
4718
|
const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
|
|
@@ -4711,21 +4728,22 @@ class Router {
|
|
|
4711
4728
|
else {
|
|
4712
4729
|
const processPreviousUrl = urlTransition && this.rawUrlTree &&
|
|
4713
4730
|
this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
|
|
4714
|
-
/* When the current URL shouldn't be processed, but the previous one
|
|
4715
|
-
* we handle this "error condition" by navigating to the
|
|
4716
|
-
* successful URL, but leaving the URL intact.*/
|
|
4731
|
+
/* When the current URL shouldn't be processed, but the previous one
|
|
4732
|
+
* was, we handle this "error condition" by navigating to the
|
|
4733
|
+
* previously successful URL, but leaving the URL intact.*/
|
|
4717
4734
|
if (processPreviousUrl) {
|
|
4718
4735
|
const { id, extractedUrl, source, restoredState, extras } = t;
|
|
4719
4736
|
const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
|
|
4720
4737
|
eventsSubject.next(navStart);
|
|
4721
4738
|
const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
|
|
4722
|
-
|
|
4739
|
+
overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
|
|
4740
|
+
return of(overallTransitionState);
|
|
4723
4741
|
}
|
|
4724
4742
|
else {
|
|
4725
|
-
/* When neither the current or previous URL can be processed, do
|
|
4726
|
-
* other than update router's internal reference to the
|
|
4727
|
-
* URL. This way the next navigation will be coming
|
|
4728
|
-
* in the browser.
|
|
4743
|
+
/* When neither the current or previous URL can be processed, do
|
|
4744
|
+
* nothing other than update router's internal reference to the
|
|
4745
|
+
* current "settled" URL. This way the next navigation will be coming
|
|
4746
|
+
* from the current URL in the browser.
|
|
4729
4747
|
*/
|
|
4730
4748
|
this.rawUrlTree = t.rawUrl;
|
|
4731
4749
|
t.resolve(null);
|
|
@@ -4737,18 +4755,20 @@ class Router {
|
|
|
4737
4755
|
tap(t => {
|
|
4738
4756
|
const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
|
4739
4757
|
this.triggerEvent(guardsStart);
|
|
4740
|
-
}), map(t =>
|
|
4758
|
+
}), map(t => {
|
|
4759
|
+
overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) });
|
|
4760
|
+
return overallTransitionState;
|
|
4761
|
+
}), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
|
|
4762
|
+
overallTransitionState.guardsResult = t.guardsResult;
|
|
4741
4763
|
if (isUrlTree(t.guardsResult)) {
|
|
4742
|
-
|
|
4743
|
-
error.url = t.guardsResult;
|
|
4744
|
-
throw error;
|
|
4764
|
+
throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
|
|
4745
4765
|
}
|
|
4746
4766
|
const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
|
|
4747
4767
|
this.triggerEvent(guardsEnd);
|
|
4748
4768
|
}), filter(t => {
|
|
4749
4769
|
if (!t.guardsResult) {
|
|
4750
4770
|
this.restoreHistory(t);
|
|
4751
|
-
this.cancelNavigationTransition(t, '');
|
|
4771
|
+
this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
|
|
4752
4772
|
return false;
|
|
4753
4773
|
}
|
|
4754
4774
|
return true;
|
|
@@ -4766,7 +4786,9 @@ class Router {
|
|
|
4766
4786
|
complete: () => {
|
|
4767
4787
|
if (!dataResolved) {
|
|
4768
4788
|
this.restoreHistory(t);
|
|
4769
|
-
this.cancelNavigationTransition(t,
|
|
4789
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
|
|
4790
|
+
`At least one route resolver didn't emit any value.` :
|
|
4791
|
+
'', 2 /* NavigationCancellationCode.NoDataFromResolver */);
|
|
4770
4792
|
}
|
|
4771
4793
|
}
|
|
4772
4794
|
}));
|
|
@@ -4776,7 +4798,7 @@ class Router {
|
|
|
4776
4798
|
}));
|
|
4777
4799
|
}
|
|
4778
4800
|
return undefined;
|
|
4779
|
-
}),
|
|
4801
|
+
}),
|
|
4780
4802
|
// --- LOAD COMPONENTS ---
|
|
4781
4803
|
switchTap((t) => {
|
|
4782
4804
|
const loadComponents = (route) => {
|
|
@@ -4796,15 +4818,16 @@ class Router {
|
|
|
4796
4818
|
};
|
|
4797
4819
|
return combineLatest(loadComponents(t.targetSnapshot.root))
|
|
4798
4820
|
.pipe(defaultIfEmpty(), take(1));
|
|
4799
|
-
}), map((t) => {
|
|
4821
|
+
}), switchTap(() => this.afterPreactivation()), map((t) => {
|
|
4800
4822
|
const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4801
|
-
|
|
4823
|
+
overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
|
|
4824
|
+
return (overallTransitionState);
|
|
4802
4825
|
}),
|
|
4803
|
-
/* Once here, we are about to activate
|
|
4804
|
-
will succeed, and user code may read from the Router service.
|
|
4805
|
-
before activation, we need to update router properties storing
|
|
4806
|
-
URL and the RouterState, as well as updated the browser URL.
|
|
4807
|
-
happen *before* activating. */
|
|
4826
|
+
/* Once here, we are about to activate synchronously. The assumption is
|
|
4827
|
+
this will succeed, and user code may read from the Router service.
|
|
4828
|
+
Therefore before activation, we need to update router properties storing
|
|
4829
|
+
the current URL and the RouterState, as well as updated the browser URL.
|
|
4830
|
+
All this should happen *before* activating. */
|
|
4808
4831
|
tap((t) => {
|
|
4809
4832
|
this.currentUrlTree = t.urlAfterRedirects;
|
|
4810
4833
|
this.rawUrlTree =
|
|
@@ -4825,80 +4848,76 @@ class Router {
|
|
|
4825
4848
|
}
|
|
4826
4849
|
}), finalize(() => {
|
|
4827
4850
|
var _a;
|
|
4828
|
-
/* When the navigation stream finishes either through error or success,
|
|
4829
|
-
* set the `completed` or `errored` flag. However, there are some
|
|
4830
|
-
* where we could get here without either of those being set.
|
|
4831
|
-
* redirect during NavigationStart. Therefore, this is a
|
|
4832
|
-
* sure the NavigationCancel
|
|
4833
|
-
*
|
|
4834
|
-
* means. */
|
|
4851
|
+
/* When the navigation stream finishes either through error or success,
|
|
4852
|
+
* we set the `completed` or `errored` flag. However, there are some
|
|
4853
|
+
* situations where we could get here without either of those being set.
|
|
4854
|
+
* For instance, a redirect during NavigationStart. Therefore, this is a
|
|
4855
|
+
* catch-all to make sure the NavigationCancel event is fired when a
|
|
4856
|
+
* navigation gets cancelled but not caught by other means. */
|
|
4835
4857
|
if (!completed && !errored) {
|
|
4836
|
-
const cancelationReason =
|
|
4837
|
-
|
|
4858
|
+
const cancelationReason = NG_DEV_MODE$1 ?
|
|
4859
|
+
`Navigation ID ${overallTransitionState
|
|
4860
|
+
.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
4861
|
+
'';
|
|
4862
|
+
this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
|
|
4838
4863
|
}
|
|
4839
4864
|
// Only clear current navigation if it is still set to the one that
|
|
4840
4865
|
// finalized.
|
|
4841
|
-
if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) ===
|
|
4866
|
+
if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === overallTransitionState.id) {
|
|
4842
4867
|
this.currentNavigation = null;
|
|
4843
4868
|
}
|
|
4844
4869
|
}), catchError((e) => {
|
|
4845
|
-
|
|
4846
|
-
// reflect the current state of the whole transition because some operations
|
|
4847
|
-
// return a new object rather than modifying the one in the outermost
|
|
4848
|
-
// `switchMap`.
|
|
4849
|
-
// The fix can likely be to:
|
|
4850
|
-
// 1. Rename the outer `t` variable so it's not shadowed all the time and
|
|
4851
|
-
// confusing
|
|
4852
|
-
// 2. Keep reassigning to the outer variable after each stage to ensure it
|
|
4853
|
-
// gets updated. Or change the implementations to not return a copy.
|
|
4854
|
-
// Not changed yet because it affects existing code and would need to be
|
|
4855
|
-
// tested more thoroughly.
|
|
4870
|
+
var _a;
|
|
4856
4871
|
errored = true;
|
|
4857
4872
|
/* This error type is issued during Redirect, and is handled as a
|
|
4858
4873
|
* cancellation rather than an error. */
|
|
4859
|
-
if (isNavigationCancelingError(e)) {
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
//
|
|
4863
|
-
//
|
|
4864
|
-
//
|
|
4865
|
-
//
|
|
4866
|
-
//
|
|
4874
|
+
if (isNavigationCancelingError$1(e)) {
|
|
4875
|
+
if (!isRedirectingNavigationCancelingError$1(e)) {
|
|
4876
|
+
// Set property only if we're not redirecting. If we landed on a page
|
|
4877
|
+
// and redirect to `/` route, the new navigation is going to see the
|
|
4878
|
+
// `/` isn't a change from the default currentUrlTree and won't
|
|
4879
|
+
// navigate. This is only applicable with initial navigation, so
|
|
4880
|
+
// setting `navigated` only when not redirecting resolves this
|
|
4881
|
+
// scenario.
|
|
4867
4882
|
this.navigated = true;
|
|
4868
|
-
this.restoreHistory(
|
|
4883
|
+
this.restoreHistory(overallTransitionState, true);
|
|
4869
4884
|
}
|
|
4870
|
-
const navCancel = new NavigationCancel(
|
|
4885
|
+
const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
|
|
4871
4886
|
eventsSubject.next(navCancel);
|
|
4872
4887
|
// When redirecting, we need to delay resolving the navigation
|
|
4873
4888
|
// promise and push it to the redirect navigation
|
|
4874
|
-
if (!
|
|
4875
|
-
|
|
4889
|
+
if (!isRedirectingNavigationCancelingError$1(e)) {
|
|
4890
|
+
overallTransitionState.resolve(false);
|
|
4876
4891
|
}
|
|
4877
4892
|
else {
|
|
4878
4893
|
const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
|
|
4879
4894
|
const extras = {
|
|
4880
|
-
skipLocationChange:
|
|
4895
|
+
skipLocationChange: overallTransitionState.extras.skipLocationChange,
|
|
4881
4896
|
// The URL is already updated at this point if we have 'eager' URL
|
|
4882
4897
|
// updates or if the navigation was triggered by the browser (back
|
|
4883
|
-
// button, URL bar, etc). We want to replace that item in history
|
|
4884
|
-
// the navigation is rejected.
|
|
4898
|
+
// button, URL bar, etc). We want to replace that item in history
|
|
4899
|
+
// if the navigation is rejected.
|
|
4885
4900
|
replaceUrl: this.urlUpdateStrategy === 'eager' ||
|
|
4886
|
-
isBrowserTriggeredNavigation(
|
|
4901
|
+
isBrowserTriggeredNavigation(overallTransitionState.source)
|
|
4887
4902
|
};
|
|
4888
|
-
this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
|
|
4903
|
+
this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
|
|
4904
|
+
resolve: overallTransitionState.resolve,
|
|
4905
|
+
reject: overallTransitionState.reject,
|
|
4906
|
+
promise: overallTransitionState.promise
|
|
4907
|
+
});
|
|
4889
4908
|
}
|
|
4890
|
-
/* All other errors should reset to the router's internal URL reference
|
|
4891
|
-
* the pre-error state. */
|
|
4909
|
+
/* All other errors should reset to the router's internal URL reference
|
|
4910
|
+
* to the pre-error state. */
|
|
4892
4911
|
}
|
|
4893
4912
|
else {
|
|
4894
|
-
this.restoreHistory(
|
|
4895
|
-
const navError = new NavigationError(
|
|
4913
|
+
this.restoreHistory(overallTransitionState, true);
|
|
4914
|
+
const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
|
|
4896
4915
|
eventsSubject.next(navError);
|
|
4897
4916
|
try {
|
|
4898
|
-
|
|
4917
|
+
overallTransitionState.resolve(this.errorHandler(e));
|
|
4899
4918
|
}
|
|
4900
4919
|
catch (ee) {
|
|
4901
|
-
|
|
4920
|
+
overallTransitionState.reject(ee);
|
|
4902
4921
|
}
|
|
4903
4922
|
}
|
|
4904
4923
|
return EMPTY;
|
|
@@ -5296,7 +5315,7 @@ class Router {
|
|
|
5296
5315
|
// The navigator change the location before triggered the browser event,
|
|
5297
5316
|
// so we need to go back to the current url if the navigation is canceled.
|
|
5298
5317
|
// Also, when navigation gets cancelled while using url update strategy eager, then we need to
|
|
5299
|
-
// go back. Because, when `
|
|
5318
|
+
// go back. Because, when `urlUpdateStrategy` is `eager`; `setBrowserUrl` method is called
|
|
5300
5319
|
// before any verification.
|
|
5301
5320
|
const browserUrlUpdateOccurred = (t.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
|
|
5302
5321
|
this.currentUrlTree === ((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.finalUrl));
|
|
@@ -5342,8 +5361,8 @@ class Router {
|
|
|
5342
5361
|
resetUrlToCurrentUrlTree() {
|
|
5343
5362
|
this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
|
|
5344
5363
|
}
|
|
5345
|
-
cancelNavigationTransition(t, reason) {
|
|
5346
|
-
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason);
|
|
5364
|
+
cancelNavigationTransition(t, reason, code) {
|
|
5365
|
+
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
|
|
5347
5366
|
this.triggerEvent(navCancel);
|
|
5348
5367
|
t.resolve(false);
|
|
5349
5368
|
}
|
|
@@ -5354,16 +5373,16 @@ class Router {
|
|
|
5354
5373
|
return { navigationId };
|
|
5355
5374
|
}
|
|
5356
5375
|
}
|
|
5357
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
5358
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0
|
|
5359
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
5376
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5377
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router });
|
|
5378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router, decorators: [{
|
|
5360
5379
|
type: Injectable
|
|
5361
5380
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5362
5381
|
function validateCommands(commands) {
|
|
5363
5382
|
for (let i = 0; i < commands.length; i++) {
|
|
5364
5383
|
const cmd = commands[i];
|
|
5365
5384
|
if (cmd == null) {
|
|
5366
|
-
throw new
|
|
5385
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5367
5386
|
}
|
|
5368
5387
|
}
|
|
5369
5388
|
}
|
|
@@ -5548,9 +5567,9 @@ class RouterLink {
|
|
|
5548
5567
|
});
|
|
5549
5568
|
}
|
|
5550
5569
|
}
|
|
5551
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
5552
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0
|
|
5553
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
5570
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5571
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.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 });
|
|
5572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLink, decorators: [{
|
|
5554
5573
|
type: Directive,
|
|
5555
5574
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5556
5575
|
}], ctorParameters: function () {
|
|
@@ -5669,9 +5688,9 @@ class RouterLinkWithHref {
|
|
|
5669
5688
|
});
|
|
5670
5689
|
}
|
|
5671
5690
|
}
|
|
5672
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
5673
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0
|
|
5674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
5691
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5692
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.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 });
|
|
5693
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5675
5694
|
type: Directive,
|
|
5676
5695
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5677
5696
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5898,9 +5917,9 @@ class RouterLinkActive {
|
|
|
5898
5917
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5899
5918
|
}
|
|
5900
5919
|
}
|
|
5901
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
5902
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0
|
|
5903
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
5920
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
|
|
5921
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.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 });
|
|
5922
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5904
5923
|
type: Directive,
|
|
5905
5924
|
args: [{
|
|
5906
5925
|
selector: '[routerLinkActive]',
|
|
@@ -5986,6 +6005,12 @@ class TitleStrategy {
|
|
|
5986
6005
|
return snapshot.data[RouteTitle];
|
|
5987
6006
|
}
|
|
5988
6007
|
}
|
|
6008
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6009
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
6010
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
6011
|
+
type: Injectable,
|
|
6012
|
+
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
6013
|
+
}] });
|
|
5989
6014
|
/**
|
|
5990
6015
|
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
|
|
5991
6016
|
*/
|
|
@@ -6006,9 +6031,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
6006
6031
|
}
|
|
6007
6032
|
}
|
|
6008
6033
|
}
|
|
6009
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
6010
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0
|
|
6011
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
6034
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6035
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
6036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
6012
6037
|
type: Injectable,
|
|
6013
6038
|
args: [{ providedIn: 'root' }]
|
|
6014
6039
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -6045,9 +6070,9 @@ class PreloadAllModules {
|
|
|
6045
6070
|
return fn().pipe(catchError(() => of(null)));
|
|
6046
6071
|
}
|
|
6047
6072
|
}
|
|
6048
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
6049
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0
|
|
6050
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
6073
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6074
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6075
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6051
6076
|
type: Injectable,
|
|
6052
6077
|
args: [{ providedIn: 'root' }]
|
|
6053
6078
|
}] });
|
|
@@ -6065,9 +6090,9 @@ class NoPreloading {
|
|
|
6065
6090
|
return of(null);
|
|
6066
6091
|
}
|
|
6067
6092
|
}
|
|
6068
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
6069
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0
|
|
6070
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
6093
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6094
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6095
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6071
6096
|
type: Injectable,
|
|
6072
6097
|
args: [{ providedIn: 'root' }]
|
|
6073
6098
|
}] });
|
|
@@ -6155,9 +6180,9 @@ class RouterPreloader {
|
|
|
6155
6180
|
});
|
|
6156
6181
|
}
|
|
6157
6182
|
}
|
|
6158
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
6159
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0
|
|
6160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
6183
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6184
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader });
|
|
6185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6161
6186
|
type: Injectable
|
|
6162
6187
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6163
6188
|
|
|
@@ -6237,9 +6262,9 @@ class RouterScroller {
|
|
|
6237
6262
|
}
|
|
6238
6263
|
}
|
|
6239
6264
|
}
|
|
6240
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
6241
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0
|
|
6242
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
6265
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6266
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller });
|
|
6267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6243
6268
|
type: Injectable
|
|
6244
6269
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6245
6270
|
|
|
@@ -6276,9 +6301,9 @@ const ROUTER_PROVIDERS = [
|
|
|
6276
6301
|
provide: Router,
|
|
6277
6302
|
useFactory: setupRouter,
|
|
6278
6303
|
deps: [
|
|
6279
|
-
UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
|
|
6280
|
-
ROUTER_CONFIGURATION,
|
|
6281
|
-
[
|
|
6304
|
+
UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES, TitleStrategy,
|
|
6305
|
+
ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()],
|
|
6306
|
+
[RouteReuseStrategy, new Optional()]
|
|
6282
6307
|
]
|
|
6283
6308
|
},
|
|
6284
6309
|
ChildrenOutletContexts,
|
|
@@ -6372,10 +6397,10 @@ class RouterModule {
|
|
|
6372
6397
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6373
6398
|
}
|
|
6374
6399
|
}
|
|
6375
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0
|
|
6376
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0
|
|
6377
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0
|
|
6378
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0
|
|
6400
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6401
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6402
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule });
|
|
6403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, decorators: [{
|
|
6379
6404
|
type: NgModule,
|
|
6380
6405
|
args: [{
|
|
6381
6406
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6413,7 +6438,7 @@ function providePathLocationStrategy() {
|
|
|
6413
6438
|
}
|
|
6414
6439
|
function provideForRootGuard(router) {
|
|
6415
6440
|
if (NG_DEV_MODE && router) {
|
|
6416
|
-
throw new
|
|
6441
|
+
throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6417
6442
|
}
|
|
6418
6443
|
return 'guarded';
|
|
6419
6444
|
}
|
|
@@ -6439,7 +6464,7 @@ function provideRoutes(routes) {
|
|
|
6439
6464
|
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6440
6465
|
];
|
|
6441
6466
|
}
|
|
6442
|
-
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {},
|
|
6467
|
+
function setupRouter(urlSerializer, contexts, location, injector, compiler, config, titleStrategy, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
|
|
6443
6468
|
const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
|
|
6444
6469
|
if (urlHandlingStrategy) {
|
|
6445
6470
|
router.urlHandlingStrategy = urlHandlingStrategy;
|
|
@@ -6447,7 +6472,7 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
6447
6472
|
if (routeReuseStrategy) {
|
|
6448
6473
|
router.routeReuseStrategy = routeReuseStrategy;
|
|
6449
6474
|
}
|
|
6450
|
-
router.titleStrategy = titleStrategy
|
|
6475
|
+
router.titleStrategy = titleStrategy;
|
|
6451
6476
|
assignExtraOptionsToRouter(opts, router);
|
|
6452
6477
|
return router;
|
|
6453
6478
|
}
|
|
@@ -6540,17 +6565,50 @@ function provideEnabledBlockingInitialNavigation() {
|
|
|
6540
6565
|
useFactory: (injector) => {
|
|
6541
6566
|
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6542
6567
|
let initNavigation = false;
|
|
6568
|
+
/**
|
|
6569
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6570
|
+
*
|
|
6571
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6572
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6573
|
+
*/
|
|
6574
|
+
function afterNextNavigation(action) {
|
|
6575
|
+
const router = injector.get(Router);
|
|
6576
|
+
router.events
|
|
6577
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6578
|
+
e instanceof NavigationError), map(e => {
|
|
6579
|
+
if (e instanceof NavigationEnd) {
|
|
6580
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6581
|
+
return true;
|
|
6582
|
+
}
|
|
6583
|
+
const redirecting = e instanceof NavigationCancel ?
|
|
6584
|
+
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6585
|
+
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6586
|
+
false;
|
|
6587
|
+
return redirecting ? null : false;
|
|
6588
|
+
}), filter((result) => result !== null), take(1))
|
|
6589
|
+
.subscribe(() => {
|
|
6590
|
+
action();
|
|
6591
|
+
});
|
|
6592
|
+
}
|
|
6543
6593
|
return () => {
|
|
6544
6594
|
return locationInitialized.then(() => {
|
|
6545
6595
|
return new Promise(resolve => {
|
|
6546
6596
|
const router = injector.get(Router);
|
|
6547
6597
|
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6598
|
+
afterNextNavigation(() => {
|
|
6599
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6600
|
+
// without a redirect.
|
|
6601
|
+
resolve(true);
|
|
6602
|
+
initNavigation = true;
|
|
6603
|
+
});
|
|
6548
6604
|
router.afterPreactivation = () => {
|
|
6549
|
-
//
|
|
6605
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6606
|
+
// assume activation will complete successfully (even though this is not
|
|
6607
|
+
// guaranteed).
|
|
6608
|
+
resolve(true);
|
|
6609
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6550
6610
|
if (!initNavigation) {
|
|
6551
|
-
|
|
6552
|
-
resolve(true);
|
|
6553
|
-
return bootstrapDone;
|
|
6611
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6554
6612
|
// subsequent navigations should not be delayed
|
|
6555
6613
|
}
|
|
6556
6614
|
else {
|
|
@@ -6622,7 +6680,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6622
6680
|
/**
|
|
6623
6681
|
* @publicApi
|
|
6624
6682
|
*/
|
|
6625
|
-
const VERSION = new Version('14.1.0
|
|
6683
|
+
const VERSION = new Version('14.1.0');
|
|
6626
6684
|
|
|
6627
6685
|
/**
|
|
6628
6686
|
* @license
|