@angular/router 14.1.0-next.1 → 14.1.0-next.4
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 +12 -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 +13 -3
- package/esm2020/src/index.mjs +1 -1
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/operators/check_guards.mjs +15 -47
- package/esm2020/src/page_title_strategy.mjs +3 -3
- package/esm2020/src/private_export.mjs +2 -2
- package/esm2020/src/recognize.mjs +7 -7
- package/esm2020/src/router.mjs +22 -17
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +187 -138
- package/esm2020/src/router_preloader.mjs +16 -4
- package/esm2020/src/router_scroller.mjs +6 -5
- package/esm2020/src/shared.mjs +3 -2
- package/esm2020/src/url_tree.mjs +6 -4
- package/esm2020/src/utils/config.mjs +17 -17
- package/esm2020/src/utils/config_matching.mjs +5 -2
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +8 -8
- package/fesm2015/router.mjs +332 -273
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +8 -8
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +326 -270
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +8 -8
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +80 -9
- package/package.json +4 -4
- package/testing/index.d.ts +2 -2
- package/upgrade/index.d.ts +1 -1
package/fesm2020/router.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.0-next.
|
|
2
|
+
* @license Angular v14.1.0-next.4
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
|
|
9
9
|
import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import * as i3 from '@angular/common';
|
|
11
|
-
import { Location, LocationStrategy,
|
|
11
|
+
import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
|
|
12
12
|
import { map, switchMap, take, startWith, scan, filter, mergeMap, first, concatMap, tap, catchError, 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
|
|
|
@@ -60,9 +60,10 @@ class ParamsAsMap {
|
|
|
60
60
|
function convertToParamMap(params) {
|
|
61
61
|
return new ParamsAsMap(params);
|
|
62
62
|
}
|
|
63
|
+
const REDIRECTING_CANCELLATION_REASON = 'Redirecting to ';
|
|
63
64
|
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
|
64
65
|
function navigationCancelingError(message) {
|
|
65
|
-
const error = Error('NavigationCancelingError: ' + message);
|
|
66
|
+
const error = Error('NavigationCancelingError: ' + (message || ''));
|
|
66
67
|
error[NAVIGATION_CANCELING_ERROR] = true;
|
|
67
68
|
return error;
|
|
68
69
|
}
|
|
@@ -191,6 +192,7 @@ function wrapIntoObservable(value) {
|
|
|
191
192
|
* Use of this source code is governed by an MIT-style license that can be
|
|
192
193
|
* found in the LICENSE file at https://angular.io/license
|
|
193
194
|
*/
|
|
195
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
194
196
|
function createEmptyUrlTree() {
|
|
195
197
|
return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
|
|
196
198
|
}
|
|
@@ -655,7 +657,7 @@ class UrlParser {
|
|
|
655
657
|
parseSegment() {
|
|
656
658
|
const path = matchSegments(this.remaining);
|
|
657
659
|
if (path === '' && this.peekStartsWith(';')) {
|
|
658
|
-
throw new
|
|
660
|
+
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
|
|
659
661
|
}
|
|
660
662
|
this.capture(path);
|
|
661
663
|
return new UrlSegment(decode(path), this.parseMatrixParams());
|
|
@@ -724,7 +726,7 @@ class UrlParser {
|
|
|
724
726
|
// if is is not one of these characters, then the segment was unescaped
|
|
725
727
|
// or the group was not closed
|
|
726
728
|
if (next !== '/' && next !== ')' && next !== ';') {
|
|
727
|
-
throw new
|
|
729
|
+
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
|
|
728
730
|
}
|
|
729
731
|
let outletName = undefined;
|
|
730
732
|
if (path.indexOf(':') > -1) {
|
|
@@ -755,7 +757,7 @@ class UrlParser {
|
|
|
755
757
|
}
|
|
756
758
|
capture(str) {
|
|
757
759
|
if (!this.consumeOptional(str)) {
|
|
758
|
-
throw new
|
|
760
|
+
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
|
|
759
761
|
}
|
|
760
762
|
}
|
|
761
763
|
}
|
|
@@ -805,6 +807,7 @@ function mergeTrivialChildren(s) {
|
|
|
805
807
|
* Use of this source code is governed by an MIT-style license that can be
|
|
806
808
|
* found in the LICENSE file at https://angular.io/license
|
|
807
809
|
*/
|
|
810
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
808
811
|
/**
|
|
809
812
|
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
810
813
|
*
|
|
@@ -980,11 +983,11 @@ class Navigation {
|
|
|
980
983
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
981
984
|
this.commands = commands;
|
|
982
985
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
983
|
-
throw new
|
|
986
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
|
|
984
987
|
}
|
|
985
988
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
986
989
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
987
|
-
throw new
|
|
990
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
|
|
988
991
|
}
|
|
989
992
|
}
|
|
990
993
|
toRoot() {
|
|
@@ -1083,7 +1086,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1083
1086
|
dd -= ci;
|
|
1084
1087
|
g = g.parent;
|
|
1085
1088
|
if (!g) {
|
|
1086
|
-
throw new
|
|
1089
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
|
|
1087
1090
|
}
|
|
1088
1091
|
ci = g.segments.length;
|
|
1089
1092
|
}
|
|
@@ -1338,10 +1341,20 @@ class NavigationCancel extends RouterEvent {
|
|
|
1338
1341
|
id,
|
|
1339
1342
|
/** @docsNotRequired */
|
|
1340
1343
|
url,
|
|
1341
|
-
/**
|
|
1342
|
-
|
|
1344
|
+
/**
|
|
1345
|
+
* A description of why the navigation was cancelled. For debug purposes only. Use `code`
|
|
1346
|
+
* instead for a stable cancellation reason that can be used in production.
|
|
1347
|
+
*/
|
|
1348
|
+
reason,
|
|
1349
|
+
/**
|
|
1350
|
+
* A code to indicate why the navigation was canceled. This cancellation code is stable for
|
|
1351
|
+
* the reason and can be relied on whereas the `reason` string could change and should not be
|
|
1352
|
+
* used in production.
|
|
1353
|
+
*/
|
|
1354
|
+
code) {
|
|
1343
1355
|
super(id, url);
|
|
1344
1356
|
this.reason = reason;
|
|
1357
|
+
this.code = code;
|
|
1345
1358
|
this.type = 2 /* EventType.NavigationCancel */;
|
|
1346
1359
|
}
|
|
1347
1360
|
/** @docsNotRequired */
|
|
@@ -2315,6 +2328,7 @@ class ChildrenOutletContexts {
|
|
|
2315
2328
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2316
2329
|
* found in the LICENSE file at https://angular.io/license
|
|
2317
2330
|
*/
|
|
2331
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2318
2332
|
/**
|
|
2319
2333
|
* @description
|
|
2320
2334
|
*
|
|
@@ -2391,7 +2405,10 @@ class RouterOutlet {
|
|
|
2391
2405
|
}
|
|
2392
2406
|
/** @nodoc */
|
|
2393
2407
|
ngOnDestroy() {
|
|
2394
|
-
this.
|
|
2408
|
+
// Ensure that the registered outlet is this one before removing it on the context.
|
|
2409
|
+
if (this.parentContexts.getContext(this.name)?.outlet === this) {
|
|
2410
|
+
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
2411
|
+
}
|
|
2395
2412
|
}
|
|
2396
2413
|
/** @nodoc */
|
|
2397
2414
|
ngOnInit() {
|
|
@@ -2420,12 +2437,12 @@ class RouterOutlet {
|
|
|
2420
2437
|
*/
|
|
2421
2438
|
get component() {
|
|
2422
2439
|
if (!this.activated)
|
|
2423
|
-
throw new
|
|
2440
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2424
2441
|
return this.activated.instance;
|
|
2425
2442
|
}
|
|
2426
2443
|
get activatedRoute() {
|
|
2427
2444
|
if (!this.activated)
|
|
2428
|
-
throw new
|
|
2445
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2429
2446
|
return this._activatedRoute;
|
|
2430
2447
|
}
|
|
2431
2448
|
get activatedRouteData() {
|
|
@@ -2439,7 +2456,7 @@ class RouterOutlet {
|
|
|
2439
2456
|
*/
|
|
2440
2457
|
detach() {
|
|
2441
2458
|
if (!this.activated)
|
|
2442
|
-
throw new
|
|
2459
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
|
|
2443
2460
|
this.location.detach();
|
|
2444
2461
|
const cmp = this.activated;
|
|
2445
2462
|
this.activated = null;
|
|
@@ -2467,7 +2484,7 @@ class RouterOutlet {
|
|
|
2467
2484
|
}
|
|
2468
2485
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2469
2486
|
if (this.isActivated) {
|
|
2470
|
-
throw new
|
|
2487
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
|
|
2471
2488
|
}
|
|
2472
2489
|
this._activatedRoute = activatedRoute;
|
|
2473
2490
|
const location = this.location;
|
|
@@ -2489,9 +2506,9 @@ class RouterOutlet {
|
|
|
2489
2506
|
this.activateEvents.emit(this.activated.instance);
|
|
2490
2507
|
}
|
|
2491
2508
|
}
|
|
2492
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
2493
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.
|
|
2494
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
2509
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2510
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.4", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2495
2512
|
type: Directive,
|
|
2496
2513
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2497
2514
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
@@ -2548,9 +2565,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2548
2565
|
*/
|
|
2549
2566
|
class ɵEmptyOutletComponent {
|
|
2550
2567
|
}
|
|
2551
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
2552
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-next.
|
|
2553
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
2568
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2569
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-next.4", 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"] }] });
|
|
2570
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2554
2571
|
type: Component,
|
|
2555
2572
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2556
2573
|
}] });
|
|
@@ -2599,13 +2616,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
|
|
|
2599
2616
|
}
|
|
2600
2617
|
function assertStandalone(fullPath, component) {
|
|
2601
2618
|
if (component && !ɵisStandalone(component)) {
|
|
2602
|
-
throw new
|
|
2619
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
|
|
2603
2620
|
}
|
|
2604
2621
|
}
|
|
2605
2622
|
function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
2606
2623
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2607
2624
|
if (!route) {
|
|
2608
|
-
throw new
|
|
2625
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
|
|
2609
2626
|
Invalid configuration of route '${fullPath}': Encountered undefined route.
|
|
2610
2627
|
The reason might be an extra comma.
|
|
2611
2628
|
|
|
@@ -2618,47 +2635,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
|
|
|
2618
2635
|
`);
|
|
2619
2636
|
}
|
|
2620
2637
|
if (Array.isArray(route)) {
|
|
2621
|
-
throw new
|
|
2638
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
|
|
2622
2639
|
}
|
|
2623
2640
|
if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
|
|
2624
2641
|
(route.outlet && route.outlet !== PRIMARY_OUTLET)) {
|
|
2625
|
-
throw new
|
|
2642
|
+
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
2643
|
}
|
|
2627
2644
|
if (route.redirectTo && route.children) {
|
|
2628
|
-
throw new
|
|
2645
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
|
|
2629
2646
|
}
|
|
2630
2647
|
if (route.redirectTo && route.loadChildren) {
|
|
2631
|
-
throw new
|
|
2648
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
|
|
2632
2649
|
}
|
|
2633
2650
|
if (route.children && route.loadChildren) {
|
|
2634
|
-
throw new
|
|
2651
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
|
|
2635
2652
|
}
|
|
2636
2653
|
if (route.redirectTo && (route.component || route.loadComponent)) {
|
|
2637
|
-
throw new
|
|
2654
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
|
|
2638
2655
|
}
|
|
2639
2656
|
if (route.component && route.loadComponent) {
|
|
2640
|
-
throw new
|
|
2657
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
|
|
2641
2658
|
}
|
|
2642
2659
|
if (route.redirectTo && route.canActivate) {
|
|
2643
|
-
throw new
|
|
2660
|
+
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
2661
|
`so canActivate will never be executed.`);
|
|
2645
2662
|
}
|
|
2646
2663
|
if (route.path && route.matcher) {
|
|
2647
|
-
throw new
|
|
2664
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
|
|
2648
2665
|
}
|
|
2649
2666
|
if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
|
|
2650
2667
|
!route.children && !route.loadChildren) {
|
|
2651
|
-
throw new
|
|
2668
|
+
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
2669
|
}
|
|
2653
2670
|
if (route.path === void 0 && route.matcher === void 0) {
|
|
2654
|
-
throw new
|
|
2671
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
|
|
2655
2672
|
}
|
|
2656
2673
|
if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
|
|
2657
|
-
throw new
|
|
2674
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
|
|
2658
2675
|
}
|
|
2659
2676
|
if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
|
|
2660
2677
|
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
|
|
2661
|
-
throw new
|
|
2678
|
+
throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
|
2662
2679
|
}
|
|
2663
2680
|
if (requireStandaloneComponents) {
|
|
2664
2681
|
assertStandalone(fullPath, route.component);
|
|
@@ -3212,17 +3229,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
|
|
|
3212
3229
|
const canActivateObservables = canActivate.map((c) => {
|
|
3213
3230
|
return defer(() => {
|
|
3214
3231
|
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());
|
|
3232
|
+
const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
|
|
3233
|
+
guard(futureARS, futureRSS);
|
|
3234
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3226
3235
|
});
|
|
3227
3236
|
});
|
|
3228
3237
|
return of(canActivateObservables).pipe(prioritizedGuardValue());
|
|
@@ -3237,17 +3246,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
|
|
|
3237
3246
|
return defer(() => {
|
|
3238
3247
|
const guardsMapped = d.guards.map((c) => {
|
|
3239
3248
|
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());
|
|
3249
|
+
const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
|
|
3250
|
+
guard(futureARS, futureRSS);
|
|
3251
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3251
3252
|
});
|
|
3252
3253
|
return of(guardsMapped).pipe(prioritizedGuardValue());
|
|
3253
3254
|
});
|
|
@@ -3260,17 +3261,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3260
3261
|
return of(true);
|
|
3261
3262
|
const canDeactivateObservables = canDeactivate.map((c) => {
|
|
3262
3263
|
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());
|
|
3264
|
+
const guardVal = isCanDeactivate(guard) ?
|
|
3265
|
+
guard.canDeactivate(component, currARS, currRSS, futureRSS) :
|
|
3266
|
+
guard(component, currARS, currRSS, futureRSS);
|
|
3267
|
+
return wrapIntoObservable(guardVal).pipe(first());
|
|
3274
3268
|
});
|
|
3275
3269
|
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
|
3276
3270
|
}
|
|
@@ -3281,16 +3275,7 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
|
|
|
3281
3275
|
}
|
|
3282
3276
|
const canLoadObservables = canLoad.map((injectionToken) => {
|
|
3283
3277
|
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
|
-
}
|
|
3278
|
+
const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
|
|
3294
3279
|
return wrapIntoObservable(guardVal);
|
|
3295
3280
|
});
|
|
3296
3281
|
return of(canLoadObservables)
|
|
@@ -3300,7 +3285,7 @@ function redirectIfUrlTree(urlSerializer) {
|
|
|
3300
3285
|
return pipe(tap((result) => {
|
|
3301
3286
|
if (!isUrlTree(result))
|
|
3302
3287
|
return;
|
|
3303
|
-
const error = navigationCancelingError(
|
|
3288
|
+
const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON + urlSerializer.serialize(result));
|
|
3304
3289
|
error.url = result;
|
|
3305
3290
|
throw error;
|
|
3306
3291
|
}), map(result => result === true));
|
|
@@ -3337,6 +3322,9 @@ function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer)
|
|
|
3337
3322
|
if (!result.matched) {
|
|
3338
3323
|
return of(result);
|
|
3339
3324
|
}
|
|
3325
|
+
// Only create the Route's `EnvironmentInjector` if it matches the attempted
|
|
3326
|
+
// navigation
|
|
3327
|
+
injector = getOrCreateRouteInjectorIfNeeded(route, injector);
|
|
3340
3328
|
return runCanMatchGuards(injector, route, segments, urlSerializer)
|
|
3341
3329
|
.pipe(map((v) => v === true ? result : { ...noMatch$1 }));
|
|
3342
3330
|
}
|
|
@@ -3477,6 +3465,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3477
3465
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3478
3466
|
* found in the LICENSE file at https://angular.io/license
|
|
3479
3467
|
*/
|
|
3468
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3480
3469
|
class NoMatch$1 {
|
|
3481
3470
|
constructor(segmentGroup) {
|
|
3482
3471
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3494,10 +3483,12 @@ function absoluteRedirect(newTree) {
|
|
|
3494
3483
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3495
3484
|
}
|
|
3496
3485
|
function namedOutletsRedirect(redirectTo) {
|
|
3497
|
-
return throwError(new
|
|
3486
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3487
|
+
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3498
3488
|
}
|
|
3499
3489
|
function canLoadFails(route) {
|
|
3500
|
-
return throwError(navigationCancelingError(
|
|
3490
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
|
|
3491
|
+
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
|
|
3501
3492
|
}
|
|
3502
3493
|
/**
|
|
3503
3494
|
* Returns the `UrlTree` with the redirection applied.
|
|
@@ -3556,7 +3547,7 @@ class ApplyRedirects {
|
|
|
3556
3547
|
}));
|
|
3557
3548
|
}
|
|
3558
3549
|
noMatchError(e) {
|
|
3559
|
-
return new
|
|
3550
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3560
3551
|
}
|
|
3561
3552
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3562
3553
|
const root = createRoot(rootCandidate);
|
|
@@ -3675,9 +3666,8 @@ class ApplyRedirects {
|
|
|
3675
3666
|
.pipe(switchMap(({ matched, consumedSegments, remainingSegments }) => {
|
|
3676
3667
|
if (!matched)
|
|
3677
3668
|
return noMatch(rawSegmentGroup);
|
|
3678
|
-
//
|
|
3679
|
-
|
|
3680
|
-
injector = getOrCreateRouteInjectorIfNeeded(route, injector);
|
|
3669
|
+
// If the route has an injector created from providers, we should start using that.
|
|
3670
|
+
injector = route._injector ?? injector;
|
|
3681
3671
|
const childConfig$ = this.getChildConfig(injector, route, segments);
|
|
3682
3672
|
return childConfig$.pipe(mergeMap((routerConfig) => {
|
|
3683
3673
|
const childInjector = routerConfig.injector ?? injector;
|
|
@@ -3772,7 +3762,8 @@ class ApplyRedirects {
|
|
|
3772
3762
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3773
3763
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3774
3764
|
if (!pos)
|
|
3775
|
-
throw new
|
|
3765
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
|
|
3766
|
+
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3776
3767
|
return pos;
|
|
3777
3768
|
}
|
|
3778
3769
|
findOrReturn(redirectToUrlSegment, actualSegments) {
|
|
@@ -3807,7 +3798,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
|
|
|
3807
3798
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3808
3799
|
* found in the LICENSE file at https://angular.io/license
|
|
3809
3800
|
*/
|
|
3810
|
-
const NG_DEV_MODE$
|
|
3801
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3811
3802
|
class NoMatch {
|
|
3812
3803
|
}
|
|
3813
3804
|
function newObservableError(e) {
|
|
@@ -3896,7 +3887,7 @@ class Recognizer {
|
|
|
3896
3887
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3897
3888
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3898
3889
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3899
|
-
if (
|
|
3890
|
+
if (NG_DEV_MODE$3) {
|
|
3900
3891
|
// This should really never happen - we are only taking the first match for each
|
|
3901
3892
|
// outlet and merge the empty path matches.
|
|
3902
3893
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -3929,7 +3920,7 @@ class Recognizer {
|
|
|
3929
3920
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3930
3921
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3931
3922
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3932
|
-
(NG_DEV_MODE$
|
|
3923
|
+
(NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3933
3924
|
pathIndexShift));
|
|
3934
3925
|
matchResult = of({
|
|
3935
3926
|
snapshot,
|
|
@@ -3945,7 +3936,7 @@ class Recognizer {
|
|
|
3945
3936
|
return null;
|
|
3946
3937
|
}
|
|
3947
3938
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
3948
|
-
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$
|
|
3939
|
+
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ?
|
|
3949
3940
|
getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3950
3941
|
pathIndexShift));
|
|
3951
3942
|
return { snapshot, consumedSegments, remainingSegments };
|
|
@@ -3956,9 +3947,8 @@ class Recognizer {
|
|
|
3956
3947
|
return of(null);
|
|
3957
3948
|
}
|
|
3958
3949
|
const { snapshot, consumedSegments, remainingSegments } = result;
|
|
3959
|
-
//
|
|
3960
|
-
|
|
3961
|
-
injector = getOrCreateRouteInjectorIfNeeded(route, injector);
|
|
3950
|
+
// If the route has an injector created from providers, we should start using that.
|
|
3951
|
+
injector = route._injector ?? injector;
|
|
3962
3952
|
const childInjector = route._loadedInjector ?? injector;
|
|
3963
3953
|
const childConfig = getChildConfig(route);
|
|
3964
3954
|
const { segmentGroup, slicedSegments } = split(rawSegment, consumedSegments, remainingSegments,
|
|
@@ -4059,7 +4049,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4059
4049
|
if (routeWithSameOutletName) {
|
|
4060
4050
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4061
4051
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4062
|
-
throw new
|
|
4052
|
+
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}'.`);
|
|
4063
4053
|
}
|
|
4064
4054
|
names[n.value.outlet] = n.value;
|
|
4065
4055
|
});
|
|
@@ -4266,7 +4256,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4266
4256
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4267
4257
|
* found in the LICENSE file at https://angular.io/license
|
|
4268
4258
|
*/
|
|
4269
|
-
const NG_DEV_MODE$
|
|
4259
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4270
4260
|
/**
|
|
4271
4261
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4272
4262
|
*
|
|
@@ -4300,7 +4290,7 @@ class RouterConfigLoader {
|
|
|
4300
4290
|
if (this.onLoadEndListener) {
|
|
4301
4291
|
this.onLoadEndListener(route);
|
|
4302
4292
|
}
|
|
4303
|
-
NG_DEV_MODE$
|
|
4293
|
+
NG_DEV_MODE$2 && assertStandalone(route.path ?? '', component);
|
|
4304
4294
|
route._loadedComponent = component;
|
|
4305
4295
|
}), finalize(() => {
|
|
4306
4296
|
this.componentLoaders.delete(route);
|
|
@@ -4343,7 +4333,7 @@ class RouterConfigLoader {
|
|
|
4343
4333
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4344
4334
|
}
|
|
4345
4335
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4346
|
-
NG_DEV_MODE$
|
|
4336
|
+
NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4347
4337
|
return { routes, injector };
|
|
4348
4338
|
}), finalize(() => {
|
|
4349
4339
|
this.childrenLoaders.delete(route);
|
|
@@ -4365,9 +4355,9 @@ class RouterConfigLoader {
|
|
|
4365
4355
|
}));
|
|
4366
4356
|
}
|
|
4367
4357
|
}
|
|
4368
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
4369
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
4370
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
4358
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4359
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader });
|
|
4360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4371
4361
|
type: Injectable
|
|
4372
4362
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4373
4363
|
|
|
@@ -4409,7 +4399,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4409
4399
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4410
4400
|
* found in the LICENSE file at https://angular.io/license
|
|
4411
4401
|
*/
|
|
4412
|
-
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4402
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4413
4403
|
function defaultErrorHandler(error) {
|
|
4414
4404
|
throw error;
|
|
4415
4405
|
}
|
|
@@ -4734,7 +4724,8 @@ class Router {
|
|
|
4734
4724
|
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
|
|
4735
4725
|
})), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
|
|
4736
4726
|
if (isUrlTree(t.guardsResult)) {
|
|
4737
|
-
const error = navigationCancelingError(
|
|
4727
|
+
const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON +
|
|
4728
|
+
`"${this.serializeUrl(t.guardsResult)}"`);
|
|
4738
4729
|
error.url = t.guardsResult;
|
|
4739
4730
|
throw error;
|
|
4740
4731
|
}
|
|
@@ -4743,7 +4734,7 @@ class Router {
|
|
|
4743
4734
|
}), filter(t => {
|
|
4744
4735
|
if (!t.guardsResult) {
|
|
4745
4736
|
this.restoreHistory(t);
|
|
4746
|
-
this.cancelNavigationTransition(t, '');
|
|
4737
|
+
this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
|
|
4747
4738
|
return false;
|
|
4748
4739
|
}
|
|
4749
4740
|
return true;
|
|
@@ -4761,7 +4752,9 @@ class Router {
|
|
|
4761
4752
|
complete: () => {
|
|
4762
4753
|
if (!dataResolved) {
|
|
4763
4754
|
this.restoreHistory(t);
|
|
4764
|
-
this.cancelNavigationTransition(t,
|
|
4755
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
|
|
4756
|
+
`At least one route resolver didn't emit any value.` :
|
|
4757
|
+
'', 2 /* NavigationCancellationCode.NoDataFromResolver */);
|
|
4765
4758
|
}
|
|
4766
4759
|
}
|
|
4767
4760
|
}));
|
|
@@ -4771,7 +4764,7 @@ class Router {
|
|
|
4771
4764
|
}));
|
|
4772
4765
|
}
|
|
4773
4766
|
return undefined;
|
|
4774
|
-
}),
|
|
4767
|
+
}),
|
|
4775
4768
|
// --- LOAD COMPONENTS ---
|
|
4776
4769
|
switchTap((t) => {
|
|
4777
4770
|
const loadComponents = (route) => {
|
|
@@ -4790,7 +4783,7 @@ class Router {
|
|
|
4790
4783
|
};
|
|
4791
4784
|
return combineLatest(loadComponents(t.targetSnapshot.root))
|
|
4792
4785
|
.pipe(defaultIfEmpty(), take(1));
|
|
4793
|
-
}), map((t) => {
|
|
4786
|
+
}), switchTap(() => this.afterPreactivation()), map((t) => {
|
|
4794
4787
|
const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
|
4795
4788
|
return ({ ...t, targetRouterState });
|
|
4796
4789
|
}),
|
|
@@ -4826,8 +4819,10 @@ class Router {
|
|
|
4826
4819
|
* event is fired when a navigation gets cancelled but not caught by other
|
|
4827
4820
|
* means. */
|
|
4828
4821
|
if (!completed && !errored) {
|
|
4829
|
-
const cancelationReason =
|
|
4830
|
-
|
|
4822
|
+
const cancelationReason = NG_DEV_MODE$1 ?
|
|
4823
|
+
`Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
4824
|
+
'';
|
|
4825
|
+
this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
|
|
4831
4826
|
}
|
|
4832
4827
|
// Only clear current navigation if it is still set to the one that
|
|
4833
4828
|
// finalized.
|
|
@@ -4860,7 +4855,7 @@ class Router {
|
|
|
4860
4855
|
this.navigated = true;
|
|
4861
4856
|
this.restoreHistory(t, true);
|
|
4862
4857
|
}
|
|
4863
|
-
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message);
|
|
4858
|
+
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, 0 /* NavigationCancellationCode.Redirect */);
|
|
4864
4859
|
eventsSubject.next(navCancel);
|
|
4865
4860
|
// When redirecting, we need to delay resolving the navigation
|
|
4866
4861
|
// promise and push it to the redirect navigation
|
|
@@ -4988,7 +4983,7 @@ class Router {
|
|
|
4988
4983
|
* ```
|
|
4989
4984
|
*/
|
|
4990
4985
|
resetConfig(config) {
|
|
4991
|
-
NG_DEV_MODE && validateConfig(config);
|
|
4986
|
+
NG_DEV_MODE$1 && validateConfig(config);
|
|
4992
4987
|
this.config = config.map(standardizeConfig);
|
|
4993
4988
|
this.navigated = false;
|
|
4994
4989
|
this.lastSuccessfulId = -1;
|
|
@@ -5331,8 +5326,8 @@ class Router {
|
|
|
5331
5326
|
resetUrlToCurrentUrlTree() {
|
|
5332
5327
|
this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
|
|
5333
5328
|
}
|
|
5334
|
-
cancelNavigationTransition(t, reason) {
|
|
5335
|
-
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason);
|
|
5329
|
+
cancelNavigationTransition(t, reason, code) {
|
|
5330
|
+
const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
|
|
5336
5331
|
this.triggerEvent(navCancel);
|
|
5337
5332
|
t.resolve(false);
|
|
5338
5333
|
}
|
|
@@ -5343,16 +5338,16 @@ class Router {
|
|
|
5343
5338
|
return { navigationId };
|
|
5344
5339
|
}
|
|
5345
5340
|
}
|
|
5346
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5347
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5348
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5341
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5342
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router });
|
|
5343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router, decorators: [{
|
|
5349
5344
|
type: Injectable
|
|
5350
5345
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5351
5346
|
function validateCommands(commands) {
|
|
5352
5347
|
for (let i = 0; i < commands.length; i++) {
|
|
5353
5348
|
const cmd = commands[i];
|
|
5354
5349
|
if (cmd == null) {
|
|
5355
|
-
throw new
|
|
5350
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5356
5351
|
}
|
|
5357
5352
|
}
|
|
5358
5353
|
}
|
|
@@ -5544,9 +5539,9 @@ class RouterLink {
|
|
|
5544
5539
|
});
|
|
5545
5540
|
}
|
|
5546
5541
|
}
|
|
5547
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5548
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.
|
|
5549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5542
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5543
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.4", 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 });
|
|
5544
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLink, decorators: [{
|
|
5550
5545
|
type: Directive,
|
|
5551
5546
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5552
5547
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
@@ -5663,9 +5658,9 @@ class RouterLinkWithHref {
|
|
|
5663
5658
|
});
|
|
5664
5659
|
}
|
|
5665
5660
|
}
|
|
5666
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5667
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.
|
|
5668
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5661
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5662
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.4", 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 });
|
|
5663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5669
5664
|
type: Directive,
|
|
5670
5665
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5671
5666
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5890,9 +5885,9 @@ class RouterLinkActive {
|
|
|
5890
5885
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5891
5886
|
}
|
|
5892
5887
|
}
|
|
5893
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5894
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.
|
|
5895
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5888
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", 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 });
|
|
5889
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.4", 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 });
|
|
5890
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5896
5891
|
type: Directive,
|
|
5897
5892
|
args: [{
|
|
5898
5893
|
selector: '[routerLinkActive]',
|
|
@@ -5995,9 +5990,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
5995
5990
|
}
|
|
5996
5991
|
}
|
|
5997
5992
|
}
|
|
5998
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5999
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6000
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
5993
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5994
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
5995
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
6001
5996
|
type: Injectable,
|
|
6002
5997
|
args: [{ providedIn: 'root' }]
|
|
6003
5998
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -6034,6 +6029,12 @@ class PreloadAllModules {
|
|
|
6034
6029
|
return fn().pipe(catchError(() => of(null)));
|
|
6035
6030
|
}
|
|
6036
6031
|
}
|
|
6032
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6033
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6034
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6035
|
+
type: Injectable,
|
|
6036
|
+
args: [{ providedIn: 'root' }]
|
|
6037
|
+
}] });
|
|
6037
6038
|
/**
|
|
6038
6039
|
* @description
|
|
6039
6040
|
*
|
|
@@ -6048,6 +6049,12 @@ class NoPreloading {
|
|
|
6048
6049
|
return of(null);
|
|
6049
6050
|
}
|
|
6050
6051
|
}
|
|
6052
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6053
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6054
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6055
|
+
type: Injectable,
|
|
6056
|
+
args: [{ providedIn: 'root' }]
|
|
6057
|
+
}] });
|
|
6051
6058
|
/**
|
|
6052
6059
|
* The preloader optimistically loads all router configurations to
|
|
6053
6060
|
* make navigations into lazily-loaded sections of the application faster.
|
|
@@ -6130,9 +6137,9 @@ class RouterPreloader {
|
|
|
6130
6137
|
});
|
|
6131
6138
|
}
|
|
6132
6139
|
}
|
|
6133
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6134
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6135
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6140
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6141
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader });
|
|
6142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6136
6143
|
type: Injectable
|
|
6137
6144
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6138
6145
|
|
|
@@ -6143,6 +6150,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1",
|
|
|
6143
6150
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6144
6151
|
* found in the LICENSE file at https://angular.io/license
|
|
6145
6152
|
*/
|
|
6153
|
+
const ROUTER_SCROLLER = new InjectionToken('');
|
|
6146
6154
|
class RouterScroller {
|
|
6147
6155
|
constructor(router,
|
|
6148
6156
|
/** @docsNotRequired */ viewportScroller, options = {}) {
|
|
@@ -6218,9 +6226,9 @@ class RouterScroller {
|
|
|
6218
6226
|
}
|
|
6219
6227
|
}
|
|
6220
6228
|
}
|
|
6221
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6222
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6223
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6229
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6230
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller });
|
|
6231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6224
6232
|
type: Injectable
|
|
6225
6233
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6226
6234
|
|
|
@@ -6231,6 +6239,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1",
|
|
|
6231
6239
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6232
6240
|
* found in the LICENSE file at https://angular.io/license
|
|
6233
6241
|
*/
|
|
6242
|
+
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6234
6243
|
/**
|
|
6235
6244
|
* The directives defined in the `RouterModule`.
|
|
6236
6245
|
*/
|
|
@@ -6240,11 +6249,15 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6240
6249
|
*
|
|
6241
6250
|
* @publicApi
|
|
6242
6251
|
*/
|
|
6243
|
-
const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION'
|
|
6252
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
|
|
6253
|
+
providedIn: 'root',
|
|
6254
|
+
factory: () => ({}),
|
|
6255
|
+
});
|
|
6244
6256
|
/**
|
|
6245
6257
|
* @docsNotRequired
|
|
6246
6258
|
*/
|
|
6247
|
-
const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
|
|
6259
|
+
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6260
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6248
6261
|
const ROUTER_PROVIDERS = [
|
|
6249
6262
|
Location,
|
|
6250
6263
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
@@ -6259,10 +6272,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6259
6272
|
},
|
|
6260
6273
|
ChildrenOutletContexts,
|
|
6261
6274
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6262
|
-
RouterPreloader,
|
|
6263
|
-
NoPreloading,
|
|
6264
|
-
PreloadAllModules,
|
|
6265
|
-
{ provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
|
|
6266
6275
|
RouterConfigLoader,
|
|
6267
6276
|
];
|
|
6268
6277
|
function routerNgProbeToken() {
|
|
@@ -6315,6 +6324,7 @@ class RouterModule {
|
|
|
6315
6324
|
ngModule: RouterModule,
|
|
6316
6325
|
providers: [
|
|
6317
6326
|
ROUTER_PROVIDERS,
|
|
6327
|
+
NG_DEV_MODE ? (config?.enableTracing ? provideTracing() : []) : [],
|
|
6318
6328
|
provideRoutes(routes),
|
|
6319
6329
|
{
|
|
6320
6330
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6322,22 +6332,11 @@ class RouterModule {
|
|
|
6322
6332
|
deps: [[Router, new Optional(), new SkipSelf()]]
|
|
6323
6333
|
},
|
|
6324
6334
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION]
|
|
6329
|
-
},
|
|
6330
|
-
{
|
|
6331
|
-
provide: RouterScroller,
|
|
6332
|
-
useFactory: createRouterScroller,
|
|
6333
|
-
deps: [Router, ViewportScroller, ROUTER_CONFIGURATION]
|
|
6334
|
-
},
|
|
6335
|
-
{
|
|
6336
|
-
provide: PreloadingStrategy,
|
|
6337
|
-
useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
|
|
6338
|
-
NoPreloading
|
|
6339
|
-
},
|
|
6335
|
+
config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6336
|
+
provideRouterScroller(),
|
|
6337
|
+
config?.preloadingStrategy ? providePreloading(config.preloadingStrategy) : [],
|
|
6340
6338
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6339
|
+
config?.initialNavigation ? provideInitialNavigation(config) : [],
|
|
6341
6340
|
provideRouterInitializer(),
|
|
6342
6341
|
],
|
|
6343
6342
|
};
|
|
@@ -6362,10 +6361,10 @@ class RouterModule {
|
|
|
6362
6361
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6363
6362
|
}
|
|
6364
6363
|
}
|
|
6365
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6366
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.
|
|
6367
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6368
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.
|
|
6364
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6365
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6366
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule });
|
|
6367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule, decorators: [{
|
|
6369
6368
|
type: NgModule,
|
|
6370
6369
|
args: [{
|
|
6371
6370
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6379,19 +6378,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1",
|
|
|
6379
6378
|
}] }, { type: Router, decorators: [{
|
|
6380
6379
|
type: Optional
|
|
6381
6380
|
}] }]; } });
|
|
6382
|
-
function
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6381
|
+
function provideRouterScroller() {
|
|
6382
|
+
return {
|
|
6383
|
+
provide: ROUTER_SCROLLER,
|
|
6384
|
+
useFactory: () => {
|
|
6385
|
+
const router = inject(Router);
|
|
6386
|
+
const viewportScroller = inject(ViewportScroller);
|
|
6387
|
+
const config = inject(ROUTER_CONFIGURATION);
|
|
6388
|
+
if (config.scrollOffset) {
|
|
6389
|
+
viewportScroller.setOffset(config.scrollOffset);
|
|
6390
|
+
}
|
|
6391
|
+
return new RouterScroller(router, viewportScroller, config);
|
|
6392
|
+
},
|
|
6393
|
+
};
|
|
6394
|
+
}
|
|
6395
|
+
function provideHashLocationStrategy() {
|
|
6396
|
+
return { provide: LocationStrategy, useClass: HashLocationStrategy };
|
|
6387
6397
|
}
|
|
6388
|
-
function
|
|
6389
|
-
return
|
|
6390
|
-
new PathLocationStrategy(platformLocationStrategy, baseHref);
|
|
6398
|
+
function providePathLocationStrategy() {
|
|
6399
|
+
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6391
6400
|
}
|
|
6392
6401
|
function provideForRootGuard(router) {
|
|
6393
|
-
if (
|
|
6394
|
-
throw new
|
|
6402
|
+
if (NG_DEV_MODE && router) {
|
|
6403
|
+
throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6395
6404
|
}
|
|
6396
6405
|
return 'guarded';
|
|
6397
6406
|
}
|
|
@@ -6427,16 +6436,6 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
6427
6436
|
}
|
|
6428
6437
|
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
6429
6438
|
assignExtraOptionsToRouter(opts, router);
|
|
6430
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && opts.enableTracing) {
|
|
6431
|
-
router.events.subscribe((e) => {
|
|
6432
|
-
// tslint:disable:no-console
|
|
6433
|
-
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6434
|
-
console.log(stringifyEvent(e));
|
|
6435
|
-
console.log(e);
|
|
6436
|
-
console.groupEnd?.();
|
|
6437
|
-
// tslint:enable:no-console
|
|
6438
|
-
});
|
|
6439
|
-
}
|
|
6440
6439
|
return router;
|
|
6441
6440
|
}
|
|
6442
6441
|
function assignExtraOptionsToRouter(opts, router) {
|
|
@@ -6465,112 +6464,169 @@ function assignExtraOptionsToRouter(opts, router) {
|
|
|
6465
6464
|
function rootRoute(router) {
|
|
6466
6465
|
return router.routerState.root;
|
|
6467
6466
|
}
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
* a resolver or a guard executes asynchronously.
|
|
6473
|
-
*
|
|
6474
|
-
* Next, we actually run activation in a `BOOTSTRAP_LISTENER`, using the
|
|
6475
|
-
* `afterPreactivation` hook provided by the router.
|
|
6476
|
-
* The router navigation starts, reaches the point when preactivation is done, and then
|
|
6477
|
-
* pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
|
|
6478
|
-
*/
|
|
6479
|
-
class RouterInitializer {
|
|
6480
|
-
constructor(injector) {
|
|
6481
|
-
this.injector = injector;
|
|
6482
|
-
this.initNavigation = false;
|
|
6483
|
-
this.destroyed = false;
|
|
6484
|
-
this.resultOfPreactivationDone = new Subject();
|
|
6485
|
-
}
|
|
6486
|
-
appInitializer() {
|
|
6487
|
-
const p = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6488
|
-
return p.then(() => {
|
|
6489
|
-
// If the injector was destroyed, the DI lookups below will fail.
|
|
6490
|
-
if (this.destroyed) {
|
|
6491
|
-
return Promise.resolve(true);
|
|
6492
|
-
}
|
|
6493
|
-
let resolve = null;
|
|
6494
|
-
const res = new Promise(r => resolve = r);
|
|
6495
|
-
const router = this.injector.get(Router);
|
|
6496
|
-
const opts = this.injector.get(ROUTER_CONFIGURATION);
|
|
6497
|
-
if (opts.initialNavigation === 'disabled') {
|
|
6498
|
-
router.setUpLocationChangeListener();
|
|
6499
|
-
resolve(true);
|
|
6500
|
-
}
|
|
6501
|
-
else if (opts.initialNavigation === 'enabledBlocking') {
|
|
6502
|
-
router.afterPreactivation = () => {
|
|
6503
|
-
// only the initial navigation should be delayed
|
|
6504
|
-
if (!this.initNavigation) {
|
|
6505
|
-
this.initNavigation = true;
|
|
6506
|
-
resolve(true);
|
|
6507
|
-
return this.resultOfPreactivationDone;
|
|
6508
|
-
// subsequent navigations should not be delayed
|
|
6509
|
-
}
|
|
6510
|
-
else {
|
|
6511
|
-
return of(void 0);
|
|
6512
|
-
}
|
|
6513
|
-
};
|
|
6514
|
-
router.initialNavigation();
|
|
6515
|
-
}
|
|
6516
|
-
else {
|
|
6517
|
-
resolve(true);
|
|
6518
|
-
}
|
|
6519
|
-
return res;
|
|
6520
|
-
});
|
|
6521
|
-
}
|
|
6522
|
-
bootstrapListener(bootstrappedComponentRef) {
|
|
6523
|
-
const opts = this.injector.get(ROUTER_CONFIGURATION);
|
|
6524
|
-
const preloader = this.injector.get(RouterPreloader);
|
|
6525
|
-
const routerScroller = this.injector.get(RouterScroller);
|
|
6526
|
-
const router = this.injector.get(Router);
|
|
6527
|
-
const ref = this.injector.get(ApplicationRef);
|
|
6467
|
+
function getBootstrapListener() {
|
|
6468
|
+
const injector = inject(Injector);
|
|
6469
|
+
return (bootstrappedComponentRef) => {
|
|
6470
|
+
const ref = injector.get(ApplicationRef);
|
|
6528
6471
|
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6529
6472
|
return;
|
|
6530
6473
|
}
|
|
6474
|
+
const router = injector.get(Router);
|
|
6475
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6531
6476
|
// Default case
|
|
6532
|
-
if (
|
|
6477
|
+
if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
|
|
6533
6478
|
router.initialNavigation();
|
|
6534
6479
|
}
|
|
6535
|
-
|
|
6536
|
-
|
|
6480
|
+
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
6481
|
+
injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
|
|
6537
6482
|
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
}
|
|
6541
|
-
ngOnDestroy() {
|
|
6542
|
-
this.destroyed = true;
|
|
6543
|
-
}
|
|
6544
|
-
}
|
|
6545
|
-
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6546
|
-
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterInitializer });
|
|
6547
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterInitializer, decorators: [{
|
|
6548
|
-
type: Injectable
|
|
6549
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
6550
|
-
function getAppInitializer(r) {
|
|
6551
|
-
return r.appInitializer.bind(r);
|
|
6552
|
-
}
|
|
6553
|
-
function getBootstrapListener(r) {
|
|
6554
|
-
return r.bootstrapListener.bind(r);
|
|
6483
|
+
bootstrapDone.next();
|
|
6484
|
+
bootstrapDone.complete();
|
|
6485
|
+
};
|
|
6555
6486
|
}
|
|
6487
|
+
// TODO(atscott): This should not be in the public API
|
|
6556
6488
|
/**
|
|
6557
6489
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
6558
6490
|
* is called after the app is bootstrapped.
|
|
6559
6491
|
*
|
|
6560
6492
|
* @publicApi
|
|
6561
6493
|
*/
|
|
6562
|
-
const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
|
|
6494
|
+
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6495
|
+
function provideInitialNavigation(config) {
|
|
6496
|
+
return [
|
|
6497
|
+
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6498
|
+
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6499
|
+
];
|
|
6500
|
+
}
|
|
6563
6501
|
function provideRouterInitializer() {
|
|
6564
6502
|
return [
|
|
6565
|
-
|
|
6503
|
+
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
6504
|
+
// have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
|
|
6505
|
+
{ provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener },
|
|
6506
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6507
|
+
];
|
|
6508
|
+
}
|
|
6509
|
+
/**
|
|
6510
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6511
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6512
|
+
* to the activation phase.
|
|
6513
|
+
*/
|
|
6514
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6515
|
+
factory: () => {
|
|
6516
|
+
return new Subject();
|
|
6517
|
+
}
|
|
6518
|
+
});
|
|
6519
|
+
function provideEnabledBlockingInitialNavigation() {
|
|
6520
|
+
return [
|
|
6521
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
|
|
6566
6522
|
{
|
|
6567
6523
|
provide: APP_INITIALIZER,
|
|
6568
6524
|
multi: true,
|
|
6569
|
-
|
|
6570
|
-
|
|
6525
|
+
deps: [Injector],
|
|
6526
|
+
useFactory: (injector) => {
|
|
6527
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6528
|
+
let initNavigation = false;
|
|
6529
|
+
/**
|
|
6530
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6531
|
+
*
|
|
6532
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6533
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6534
|
+
*/
|
|
6535
|
+
function afterNextNavigation(action) {
|
|
6536
|
+
const router = injector.get(Router);
|
|
6537
|
+
router.events
|
|
6538
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6539
|
+
e instanceof NavigationError), map(e => {
|
|
6540
|
+
if (e instanceof NavigationEnd) {
|
|
6541
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6542
|
+
return true;
|
|
6543
|
+
}
|
|
6544
|
+
const redirecting = e instanceof NavigationCancel ?
|
|
6545
|
+
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6546
|
+
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6547
|
+
false;
|
|
6548
|
+
return redirecting ? null : false;
|
|
6549
|
+
}), filter((result) => result !== null), take(1))
|
|
6550
|
+
.subscribe(() => {
|
|
6551
|
+
action();
|
|
6552
|
+
});
|
|
6553
|
+
}
|
|
6554
|
+
return () => {
|
|
6555
|
+
return locationInitialized.then(() => {
|
|
6556
|
+
return new Promise(resolve => {
|
|
6557
|
+
const router = injector.get(Router);
|
|
6558
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6559
|
+
afterNextNavigation(() => {
|
|
6560
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6561
|
+
// without a redirect.
|
|
6562
|
+
resolve(true);
|
|
6563
|
+
initNavigation = true;
|
|
6564
|
+
});
|
|
6565
|
+
router.afterPreactivation = () => {
|
|
6566
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6567
|
+
// assume activation will complete successfully (even though this is not
|
|
6568
|
+
// guaranteed).
|
|
6569
|
+
resolve(true);
|
|
6570
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6571
|
+
if (!initNavigation) {
|
|
6572
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6573
|
+
// subsequent navigations should not be delayed
|
|
6574
|
+
}
|
|
6575
|
+
else {
|
|
6576
|
+
return of(void 0);
|
|
6577
|
+
}
|
|
6578
|
+
};
|
|
6579
|
+
router.initialNavigation();
|
|
6580
|
+
});
|
|
6581
|
+
});
|
|
6582
|
+
};
|
|
6583
|
+
}
|
|
6571
6584
|
},
|
|
6572
|
-
|
|
6573
|
-
|
|
6585
|
+
];
|
|
6586
|
+
}
|
|
6587
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
|
|
6588
|
+
function provideDisabledInitialNavigation() {
|
|
6589
|
+
return [
|
|
6590
|
+
{
|
|
6591
|
+
provide: APP_INITIALIZER,
|
|
6592
|
+
multi: true,
|
|
6593
|
+
useFactory: () => {
|
|
6594
|
+
const router = inject(Router);
|
|
6595
|
+
return () => {
|
|
6596
|
+
router.setUpLocationChangeListener();
|
|
6597
|
+
};
|
|
6598
|
+
}
|
|
6599
|
+
},
|
|
6600
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'disabled' }
|
|
6601
|
+
];
|
|
6602
|
+
}
|
|
6603
|
+
function provideTracing() {
|
|
6604
|
+
if (NG_DEV_MODE) {
|
|
6605
|
+
return [{
|
|
6606
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6607
|
+
multi: true,
|
|
6608
|
+
useFactory: () => {
|
|
6609
|
+
const router = inject(Router);
|
|
6610
|
+
return () => router.events.subscribe((e) => {
|
|
6611
|
+
// tslint:disable:no-console
|
|
6612
|
+
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6613
|
+
console.log(stringifyEvent(e));
|
|
6614
|
+
console.log(e);
|
|
6615
|
+
console.groupEnd?.();
|
|
6616
|
+
// tslint:enable:no-console
|
|
6617
|
+
});
|
|
6618
|
+
}
|
|
6619
|
+
}];
|
|
6620
|
+
}
|
|
6621
|
+
else {
|
|
6622
|
+
return [];
|
|
6623
|
+
}
|
|
6624
|
+
}
|
|
6625
|
+
function providePreloading(preloadingStrategy) {
|
|
6626
|
+
return [
|
|
6627
|
+
RouterPreloader,
|
|
6628
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6629
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6574
6630
|
];
|
|
6575
6631
|
}
|
|
6576
6632
|
|
|
@@ -6584,7 +6640,7 @@ function provideRouterInitializer() {
|
|
|
6584
6640
|
/**
|
|
6585
6641
|
* @publicApi
|
|
6586
6642
|
*/
|
|
6587
|
-
const VERSION = new Version('14.1.0-next.
|
|
6643
|
+
const VERSION = new Version('14.1.0-next.4');
|
|
6588
6644
|
|
|
6589
6645
|
/**
|
|
6590
6646
|
* @license
|
|
@@ -6623,5 +6679,5 @@ const VERSION = new Version('14.1.0-next.1');
|
|
|
6623
6679
|
* Generated bundle index. Do not edit.
|
|
6624
6680
|
*/
|
|
6625
6681
|
|
|
6626
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
|
|
6682
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
|
|
6627
6683
|
//# sourceMappingURL=router.mjs.map
|