@angular/router 14.2.0-next.1 → 14.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/directives/router_link.mjs +101 -23
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/index.mjs +3 -2
- package/esm2020/src/page_title_strategy.mjs +6 -6
- package/esm2020/src/patchable_relative_link_resolution.mjs +12 -0
- package/esm2020/src/private_export.mjs +3 -2
- package/esm2020/src/provide_router.mjs +420 -0
- package/esm2020/src/router.mjs +6 -4
- package/esm2020/src/router_config.mjs +1 -1
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +28 -185
- package/esm2020/src/router_outlet_context.mjs +3 -3
- package/esm2020/src/router_preloader.mjs +12 -11
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/url_tree.mjs +3 -3
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/provide_router_for_testing.mjs +51 -0
- package/esm2020/testing/src/router_testing_module.mjs +8 -8
- package/fesm2015/router.mjs +626 -279
- 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 +624 -277
- 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 +505 -147
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2020/router.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.2.
|
|
2
|
+
* @license Angular v14.2.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, APP_BOOTSTRAP_LISTENER, ApplicationRef, APP_INITIALIZER, ENVIRONMENT_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
|
|
9
9
|
import { from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import * as i3 from '@angular/common';
|
|
11
|
-
import { Location, ViewportScroller, LocationStrategy, HashLocationStrategy, PathLocationStrategy
|
|
11
|
+
import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
|
|
12
12
|
import { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
|
|
13
13
|
import * as i1 from '@angular/platform-browser';
|
|
14
14
|
|
|
@@ -202,7 +202,7 @@ function wrapIntoObservable(value) {
|
|
|
202
202
|
* Use of this source code is governed by an MIT-style license that can be
|
|
203
203
|
* found in the LICENSE file at https://angular.io/license
|
|
204
204
|
*/
|
|
205
|
-
const NG_DEV_MODE$
|
|
205
|
+
const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
206
206
|
function createEmptyUrlTree() {
|
|
207
207
|
return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
|
|
208
208
|
}
|
|
@@ -459,9 +459,9 @@ function mapChildrenIntoArray(segment, fn) {
|
|
|
459
459
|
*/
|
|
460
460
|
class UrlSerializer {
|
|
461
461
|
}
|
|
462
|
-
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
463
|
-
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
464
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
462
|
+
UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
463
|
+
UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
|
|
464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: UrlSerializer, decorators: [{
|
|
465
465
|
type: Injectable,
|
|
466
466
|
args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
|
|
467
467
|
}] });
|
|
@@ -673,7 +673,7 @@ class UrlParser {
|
|
|
673
673
|
parseSegment() {
|
|
674
674
|
const path = matchSegments(this.remaining);
|
|
675
675
|
if (path === '' && this.peekStartsWith(';')) {
|
|
676
|
-
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$
|
|
676
|
+
throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$9 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
|
|
677
677
|
}
|
|
678
678
|
this.capture(path);
|
|
679
679
|
return new UrlSegment(decode(path), this.parseMatrixParams());
|
|
@@ -742,7 +742,7 @@ class UrlParser {
|
|
|
742
742
|
// if is is not one of these characters, then the segment was unescaped
|
|
743
743
|
// or the group was not closed
|
|
744
744
|
if (next !== '/' && next !== ')' && next !== ';') {
|
|
745
|
-
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$
|
|
745
|
+
throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$9 && `Cannot parse url '${this.url}'`);
|
|
746
746
|
}
|
|
747
747
|
let outletName = undefined;
|
|
748
748
|
if (path.indexOf(':') > -1) {
|
|
@@ -773,7 +773,7 @@ class UrlParser {
|
|
|
773
773
|
}
|
|
774
774
|
capture(str) {
|
|
775
775
|
if (!this.consumeOptional(str)) {
|
|
776
|
-
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$
|
|
776
|
+
throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$9 && `Expected "${str}".`);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
779
|
}
|
|
@@ -826,7 +826,7 @@ function isUrlTree(v) {
|
|
|
826
826
|
* Use of this source code is governed by an MIT-style license that can be
|
|
827
827
|
* found in the LICENSE file at https://angular.io/license
|
|
828
828
|
*/
|
|
829
|
-
const NG_DEV_MODE$
|
|
829
|
+
const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
830
830
|
/**
|
|
831
831
|
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
832
832
|
*
|
|
@@ -1002,11 +1002,11 @@ class Navigation {
|
|
|
1002
1002
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
1003
1003
|
this.commands = commands;
|
|
1004
1004
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
1005
|
-
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$
|
|
1005
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
|
|
1006
1006
|
}
|
|
1007
1007
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
1008
1008
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
1009
|
-
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$
|
|
1009
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
1012
|
toRoot() {
|
|
@@ -1105,7 +1105,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1105
1105
|
dd -= ci;
|
|
1106
1106
|
g = g.parent;
|
|
1107
1107
|
if (!g) {
|
|
1108
|
-
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$
|
|
1108
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
|
|
1109
1109
|
}
|
|
1110
1110
|
ci = g.segments.length;
|
|
1111
1111
|
}
|
|
@@ -2382,9 +2382,9 @@ class ChildrenOutletContexts {
|
|
|
2382
2382
|
return this.contexts.get(childName) || null;
|
|
2383
2383
|
}
|
|
2384
2384
|
}
|
|
2385
|
-
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
2386
|
-
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
2387
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
2385
|
+
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2386
|
+
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
|
|
2387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
2388
2388
|
type: Injectable,
|
|
2389
2389
|
args: [{ providedIn: 'root' }]
|
|
2390
2390
|
}] });
|
|
@@ -2396,7 +2396,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
2396
2396
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2397
2397
|
* found in the LICENSE file at https://angular.io/license
|
|
2398
2398
|
*/
|
|
2399
|
-
const NG_DEV_MODE$
|
|
2399
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2400
2400
|
/**
|
|
2401
2401
|
* @description
|
|
2402
2402
|
*
|
|
@@ -2505,12 +2505,12 @@ class RouterOutlet {
|
|
|
2505
2505
|
*/
|
|
2506
2506
|
get component() {
|
|
2507
2507
|
if (!this.activated)
|
|
2508
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2508
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2509
2509
|
return this.activated.instance;
|
|
2510
2510
|
}
|
|
2511
2511
|
get activatedRoute() {
|
|
2512
2512
|
if (!this.activated)
|
|
2513
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2513
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2514
2514
|
return this._activatedRoute;
|
|
2515
2515
|
}
|
|
2516
2516
|
get activatedRouteData() {
|
|
@@ -2524,7 +2524,7 @@ class RouterOutlet {
|
|
|
2524
2524
|
*/
|
|
2525
2525
|
detach() {
|
|
2526
2526
|
if (!this.activated)
|
|
2527
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2527
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2528
2528
|
this.location.detach();
|
|
2529
2529
|
const cmp = this.activated;
|
|
2530
2530
|
this.activated = null;
|
|
@@ -2552,7 +2552,7 @@ class RouterOutlet {
|
|
|
2552
2552
|
}
|
|
2553
2553
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2554
2554
|
if (this.isActivated) {
|
|
2555
|
-
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$
|
|
2555
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
|
|
2556
2556
|
}
|
|
2557
2557
|
this._activatedRoute = activatedRoute;
|
|
2558
2558
|
const location = this.location;
|
|
@@ -2574,9 +2574,9 @@ class RouterOutlet {
|
|
|
2574
2574
|
this.activateEvents.emit(this.activated.instance);
|
|
2575
2575
|
}
|
|
2576
2576
|
}
|
|
2577
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
2578
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
2579
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
2577
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2578
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2580
2580
|
type: Directive,
|
|
2581
2581
|
args: [{
|
|
2582
2582
|
selector: 'router-outlet',
|
|
@@ -2637,9 +2637,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2637
2637
|
*/
|
|
2638
2638
|
class ɵEmptyOutletComponent {
|
|
2639
2639
|
}
|
|
2640
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
2641
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.
|
|
2642
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
2640
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2641
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.1", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2642
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2643
2643
|
type: Component,
|
|
2644
2644
|
args: [{
|
|
2645
2645
|
template: `<router-outlet></router-outlet>`,
|
|
@@ -3559,7 +3559,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3559
3559
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3560
3560
|
* found in the LICENSE file at https://angular.io/license
|
|
3561
3561
|
*/
|
|
3562
|
-
const NG_DEV_MODE$
|
|
3562
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3563
3563
|
class NoMatch$1 {
|
|
3564
3564
|
constructor(segmentGroup) {
|
|
3565
3565
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3577,11 +3577,11 @@ function absoluteRedirect(newTree) {
|
|
|
3577
3577
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3578
3578
|
}
|
|
3579
3579
|
function namedOutletsRedirect(redirectTo) {
|
|
3580
|
-
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$
|
|
3580
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3581
3581
|
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3582
3582
|
}
|
|
3583
3583
|
function canLoadFails(route) {
|
|
3584
|
-
return throwError(navigationCancelingError(NG_DEV_MODE$
|
|
3584
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
|
|
3585
3585
|
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3586
3586
|
}
|
|
3587
3587
|
/**
|
|
@@ -3641,7 +3641,7 @@ class ApplyRedirects {
|
|
|
3641
3641
|
}));
|
|
3642
3642
|
}
|
|
3643
3643
|
noMatchError(e) {
|
|
3644
|
-
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$
|
|
3644
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3645
3645
|
}
|
|
3646
3646
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3647
3647
|
const root = createRoot(rootCandidate);
|
|
@@ -3856,7 +3856,7 @@ class ApplyRedirects {
|
|
|
3856
3856
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3857
3857
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3858
3858
|
if (!pos)
|
|
3859
|
-
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$
|
|
3859
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3860
3860
|
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3861
3861
|
return pos;
|
|
3862
3862
|
}
|
|
@@ -3892,7 +3892,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
|
|
|
3892
3892
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3893
3893
|
* found in the LICENSE file at https://angular.io/license
|
|
3894
3894
|
*/
|
|
3895
|
-
const NG_DEV_MODE$
|
|
3895
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3896
3896
|
class NoMatch {
|
|
3897
3897
|
}
|
|
3898
3898
|
function newObservableError(e) {
|
|
@@ -3981,7 +3981,7 @@ class Recognizer {
|
|
|
3981
3981
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3982
3982
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
3983
3983
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
3984
|
-
if (NG_DEV_MODE$
|
|
3984
|
+
if (NG_DEV_MODE$5) {
|
|
3985
3985
|
// This should really never happen - we are only taking the first match for each
|
|
3986
3986
|
// outlet and merge the empty path matches.
|
|
3987
3987
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -4014,7 +4014,7 @@ class Recognizer {
|
|
|
4014
4014
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
4015
4015
|
// production bundle size. This value is intended only to surface a warning to users
|
|
4016
4016
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
4017
|
-
(NG_DEV_MODE$
|
|
4017
|
+
(NG_DEV_MODE$5 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
4018
4018
|
pathIndexShift));
|
|
4019
4019
|
matchResult = of({
|
|
4020
4020
|
snapshot,
|
|
@@ -4030,7 +4030,7 @@ class Recognizer {
|
|
|
4030
4030
|
return null;
|
|
4031
4031
|
}
|
|
4032
4032
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
4033
|
-
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$
|
|
4033
|
+
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$5 ?
|
|
4034
4034
|
getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
4035
4035
|
pathIndexShift));
|
|
4036
4036
|
return { snapshot, consumedSegments, remainingSegments };
|
|
@@ -4143,7 +4143,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4143
4143
|
if (routeWithSameOutletName) {
|
|
4144
4144
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4145
4145
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4146
|
-
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$
|
|
4146
|
+
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$5 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
|
|
4147
4147
|
}
|
|
4148
4148
|
names[n.value.outlet] = n.value;
|
|
4149
4149
|
});
|
|
@@ -4325,9 +4325,9 @@ class TitleStrategy {
|
|
|
4325
4325
|
return snapshot.data[RouteTitleKey];
|
|
4326
4326
|
}
|
|
4327
4327
|
}
|
|
4328
|
-
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
4329
|
-
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
4330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
4328
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4329
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4331
4331
|
type: Injectable,
|
|
4332
4332
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4333
4333
|
}] });
|
|
@@ -4351,13 +4351,25 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
4351
4351
|
}
|
|
4352
4352
|
}
|
|
4353
4353
|
}
|
|
4354
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
4355
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
4356
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
4354
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4355
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4357
4357
|
type: Injectable,
|
|
4358
4358
|
args: [{ providedIn: 'root' }]
|
|
4359
4359
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
4360
4360
|
|
|
4361
|
+
/**
|
|
4362
|
+
* @license
|
|
4363
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4364
|
+
*
|
|
4365
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4366
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4367
|
+
*/
|
|
4368
|
+
/**
|
|
4369
|
+
* Exists to aid internal migration off of the deprecated relativeLinkResolution option.
|
|
4370
|
+
*/
|
|
4371
|
+
function assignRelativeLinkResolution(router) { }
|
|
4372
|
+
|
|
4361
4373
|
/**
|
|
4362
4374
|
* @license
|
|
4363
4375
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4430,13 +4442,13 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4430
4442
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4431
4443
|
* found in the LICENSE file at https://angular.io/license
|
|
4432
4444
|
*/
|
|
4433
|
-
const NG_DEV_MODE$
|
|
4445
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4434
4446
|
/**
|
|
4435
4447
|
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
4436
4448
|
*
|
|
4437
4449
|
* @publicApi
|
|
4438
4450
|
*/
|
|
4439
|
-
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$
|
|
4451
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
|
|
4440
4452
|
providedIn: 'root',
|
|
4441
4453
|
factory: () => ({}),
|
|
4442
4454
|
});
|
|
@@ -4448,7 +4460,7 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config'
|
|
|
4448
4460
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4449
4461
|
* found in the LICENSE file at https://angular.io/license
|
|
4450
4462
|
*/
|
|
4451
|
-
const NG_DEV_MODE$
|
|
4463
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4452
4464
|
/**
|
|
4453
4465
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4454
4466
|
*
|
|
@@ -4482,7 +4494,7 @@ class RouterConfigLoader {
|
|
|
4482
4494
|
if (this.onLoadEndListener) {
|
|
4483
4495
|
this.onLoadEndListener(route);
|
|
4484
4496
|
}
|
|
4485
|
-
NG_DEV_MODE$
|
|
4497
|
+
NG_DEV_MODE$3 && assertStandalone(route.path ?? '', component);
|
|
4486
4498
|
route._loadedComponent = component;
|
|
4487
4499
|
}), finalize(() => {
|
|
4488
4500
|
this.componentLoaders.delete(route);
|
|
@@ -4525,7 +4537,7 @@ class RouterConfigLoader {
|
|
|
4525
4537
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4526
4538
|
}
|
|
4527
4539
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4528
|
-
NG_DEV_MODE$
|
|
4540
|
+
NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4529
4541
|
return { routes, injector };
|
|
4530
4542
|
}), finalize(() => {
|
|
4531
4543
|
this.childrenLoaders.delete(route);
|
|
@@ -4547,9 +4559,9 @@ class RouterConfigLoader {
|
|
|
4547
4559
|
}));
|
|
4548
4560
|
}
|
|
4549
4561
|
}
|
|
4550
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
4551
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
4552
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
4562
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4563
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4564
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4553
4565
|
type: Injectable,
|
|
4554
4566
|
args: [{ providedIn: 'root' }]
|
|
4555
4567
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
@@ -4592,7 +4604,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4592
4604
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4593
4605
|
* found in the LICENSE file at https://angular.io/license
|
|
4594
4606
|
*/
|
|
4595
|
-
const NG_DEV_MODE$
|
|
4607
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4596
4608
|
function defaultErrorHandler(error) {
|
|
4597
4609
|
throw error;
|
|
4598
4610
|
}
|
|
@@ -4663,6 +4675,7 @@ function setupRouter() {
|
|
|
4663
4675
|
}
|
|
4664
4676
|
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
4665
4677
|
assignExtraOptionsToRouter(opts, router);
|
|
4678
|
+
assignRelativeLinkResolution(router);
|
|
4666
4679
|
return router;
|
|
4667
4680
|
}
|
|
4668
4681
|
/**
|
|
@@ -4996,7 +5009,7 @@ class Router {
|
|
|
4996
5009
|
complete: () => {
|
|
4997
5010
|
if (!dataResolved) {
|
|
4998
5011
|
this.restoreHistory(t);
|
|
4999
|
-
this.cancelNavigationTransition(t, NG_DEV_MODE$
|
|
5012
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
|
|
5000
5013
|
`At least one route resolver didn't emit any value.` :
|
|
5001
5014
|
'', 2 /* NavigationCancellationCode.NoDataFromResolver */);
|
|
5002
5015
|
}
|
|
@@ -5063,7 +5076,7 @@ class Router {
|
|
|
5063
5076
|
* catch-all to make sure the NavigationCancel event is fired when a
|
|
5064
5077
|
* navigation gets cancelled but not caught by other means. */
|
|
5065
5078
|
if (!completed && !errored) {
|
|
5066
|
-
const cancelationReason = NG_DEV_MODE$
|
|
5079
|
+
const cancelationReason = NG_DEV_MODE$2 ?
|
|
5067
5080
|
`Navigation ID ${overallTransitionState
|
|
5068
5081
|
.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
5069
5082
|
'';
|
|
@@ -5221,7 +5234,7 @@ class Router {
|
|
|
5221
5234
|
* ```
|
|
5222
5235
|
*/
|
|
5223
5236
|
resetConfig(config) {
|
|
5224
|
-
NG_DEV_MODE$
|
|
5237
|
+
NG_DEV_MODE$2 && validateConfig(config);
|
|
5225
5238
|
this.config = config.map(standardizeConfig);
|
|
5226
5239
|
this.navigated = false;
|
|
5227
5240
|
this.lastSuccessfulId = -1;
|
|
@@ -5576,9 +5589,9 @@ class Router {
|
|
|
5576
5589
|
return { navigationId };
|
|
5577
5590
|
}
|
|
5578
5591
|
}
|
|
5579
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
5580
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
5581
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
5592
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5593
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
|
|
5594
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Router, decorators: [{
|
|
5582
5595
|
type: Injectable,
|
|
5583
5596
|
args: [{
|
|
5584
5597
|
providedIn: 'root',
|
|
@@ -5589,7 +5602,7 @@ function validateCommands(commands) {
|
|
|
5589
5602
|
for (let i = 0; i < commands.length; i++) {
|
|
5590
5603
|
const cmd = commands[i];
|
|
5591
5604
|
if (cmd == null) {
|
|
5592
|
-
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$
|
|
5605
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$2 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5593
5606
|
}
|
|
5594
5607
|
}
|
|
5595
5608
|
}
|
|
@@ -5708,11 +5721,50 @@ class RouterLink {
|
|
|
5708
5721
|
this.tabIndexAttribute = tabIndexAttribute;
|
|
5709
5722
|
this.renderer = renderer;
|
|
5710
5723
|
this.el = el;
|
|
5724
|
+
this._preserveFragment = false;
|
|
5725
|
+
this._skipLocationChange = false;
|
|
5726
|
+
this._replaceUrl = false;
|
|
5711
5727
|
this.commands = null;
|
|
5712
5728
|
/** @internal */
|
|
5713
5729
|
this.onChanges = new Subject();
|
|
5714
5730
|
this.setTabIndexIfNotOnNativeEl('0');
|
|
5715
5731
|
}
|
|
5732
|
+
/**
|
|
5733
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5734
|
+
* `UrlCreationOptions`.
|
|
5735
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5736
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5737
|
+
*/
|
|
5738
|
+
set preserveFragment(preserveFragment) {
|
|
5739
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5740
|
+
}
|
|
5741
|
+
get preserveFragment() {
|
|
5742
|
+
return this._preserveFragment;
|
|
5743
|
+
}
|
|
5744
|
+
/**
|
|
5745
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5746
|
+
* `NavigationBehaviorOptions`.
|
|
5747
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5748
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5749
|
+
*/
|
|
5750
|
+
set skipLocationChange(skipLocationChange) {
|
|
5751
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5752
|
+
}
|
|
5753
|
+
get skipLocationChange() {
|
|
5754
|
+
return this._skipLocationChange;
|
|
5755
|
+
}
|
|
5756
|
+
/**
|
|
5757
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5758
|
+
* `NavigationBehaviorOptions`.
|
|
5759
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5760
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5761
|
+
*/
|
|
5762
|
+
set replaceUrl(replaceUrl) {
|
|
5763
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5764
|
+
}
|
|
5765
|
+
get replaceUrl() {
|
|
5766
|
+
return this._replaceUrl;
|
|
5767
|
+
}
|
|
5716
5768
|
/**
|
|
5717
5769
|
* Modifies the tab index if there was not a tabindex attribute on the element during
|
|
5718
5770
|
* instantiation.
|
|
@@ -5759,8 +5811,8 @@ class RouterLink {
|
|
|
5759
5811
|
return true;
|
|
5760
5812
|
}
|
|
5761
5813
|
const extras = {
|
|
5762
|
-
skipLocationChange:
|
|
5763
|
-
replaceUrl:
|
|
5814
|
+
skipLocationChange: this.skipLocationChange,
|
|
5815
|
+
replaceUrl: this.replaceUrl,
|
|
5764
5816
|
state: this.state,
|
|
5765
5817
|
};
|
|
5766
5818
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5777,13 +5829,13 @@ class RouterLink {
|
|
|
5777
5829
|
queryParams: this.queryParams,
|
|
5778
5830
|
fragment: this.fragment,
|
|
5779
5831
|
queryParamsHandling: this.queryParamsHandling,
|
|
5780
|
-
preserveFragment:
|
|
5832
|
+
preserveFragment: this.preserveFragment,
|
|
5781
5833
|
});
|
|
5782
5834
|
}
|
|
5783
5835
|
}
|
|
5784
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
5785
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
5786
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
5836
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5837
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
5838
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLink, decorators: [{
|
|
5787
5839
|
type: Directive,
|
|
5788
5840
|
args: [{
|
|
5789
5841
|
selector: ':not(a):not(area)[routerLink]',
|
|
@@ -5798,16 +5850,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
5798
5850
|
type: Input
|
|
5799
5851
|
}], queryParamsHandling: [{
|
|
5800
5852
|
type: Input
|
|
5853
|
+
}], state: [{
|
|
5854
|
+
type: Input
|
|
5855
|
+
}], relativeTo: [{
|
|
5856
|
+
type: Input
|
|
5801
5857
|
}], preserveFragment: [{
|
|
5802
5858
|
type: Input
|
|
5803
5859
|
}], skipLocationChange: [{
|
|
5804
5860
|
type: Input
|
|
5805
5861
|
}], replaceUrl: [{
|
|
5806
5862
|
type: Input
|
|
5807
|
-
}], state: [{
|
|
5808
|
-
type: Input
|
|
5809
|
-
}], relativeTo: [{
|
|
5810
|
-
type: Input
|
|
5811
5863
|
}], routerLink: [{
|
|
5812
5864
|
type: Input
|
|
5813
5865
|
}], onClick: [{
|
|
@@ -5830,6 +5882,9 @@ class RouterLinkWithHref {
|
|
|
5830
5882
|
this.router = router;
|
|
5831
5883
|
this.route = route;
|
|
5832
5884
|
this.locationStrategy = locationStrategy;
|
|
5885
|
+
this._preserveFragment = false;
|
|
5886
|
+
this._skipLocationChange = false;
|
|
5887
|
+
this._replaceUrl = false;
|
|
5833
5888
|
this.commands = null;
|
|
5834
5889
|
// the url displayed on the anchor element.
|
|
5835
5890
|
// @HostBinding('attr.href') is used rather than @HostBinding() because it removes the
|
|
@@ -5843,6 +5898,42 @@ class RouterLinkWithHref {
|
|
|
5843
5898
|
}
|
|
5844
5899
|
});
|
|
5845
5900
|
}
|
|
5901
|
+
/**
|
|
5902
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5903
|
+
* `UrlCreationOptions`.
|
|
5904
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5905
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5906
|
+
*/
|
|
5907
|
+
set preserveFragment(preserveFragment) {
|
|
5908
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5909
|
+
}
|
|
5910
|
+
get preserveFragment() {
|
|
5911
|
+
return this._preserveFragment;
|
|
5912
|
+
}
|
|
5913
|
+
/**
|
|
5914
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5915
|
+
* `NavigationBehaviorOptions`.
|
|
5916
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5917
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5918
|
+
*/
|
|
5919
|
+
set skipLocationChange(skipLocationChange) {
|
|
5920
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5921
|
+
}
|
|
5922
|
+
get skipLocationChange() {
|
|
5923
|
+
return this._skipLocationChange;
|
|
5924
|
+
}
|
|
5925
|
+
/**
|
|
5926
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5927
|
+
* `NavigationBehaviorOptions`.
|
|
5928
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5929
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5930
|
+
*/
|
|
5931
|
+
set replaceUrl(replaceUrl) {
|
|
5932
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5933
|
+
}
|
|
5934
|
+
get replaceUrl() {
|
|
5935
|
+
return this._replaceUrl;
|
|
5936
|
+
}
|
|
5846
5937
|
/**
|
|
5847
5938
|
* Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
5848
5939
|
* - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
@@ -5876,8 +5967,8 @@ class RouterLinkWithHref {
|
|
|
5876
5967
|
return true;
|
|
5877
5968
|
}
|
|
5878
5969
|
const extras = {
|
|
5879
|
-
skipLocationChange:
|
|
5880
|
-
replaceUrl:
|
|
5970
|
+
skipLocationChange: this.skipLocationChange,
|
|
5971
|
+
replaceUrl: this.replaceUrl,
|
|
5881
5972
|
state: this.state
|
|
5882
5973
|
};
|
|
5883
5974
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5899,13 +5990,13 @@ class RouterLinkWithHref {
|
|
|
5899
5990
|
queryParams: this.queryParams,
|
|
5900
5991
|
fragment: this.fragment,
|
|
5901
5992
|
queryParamsHandling: this.queryParamsHandling,
|
|
5902
|
-
preserveFragment:
|
|
5993
|
+
preserveFragment: this.preserveFragment,
|
|
5903
5994
|
});
|
|
5904
5995
|
}
|
|
5905
5996
|
}
|
|
5906
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
5907
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
5908
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
5997
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5998
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: RouterLinkWithHref, isStandalone: true, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
|
|
5999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5909
6000
|
type: Directive,
|
|
5910
6001
|
args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
|
|
5911
6002
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5919,12 +6010,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
5919
6010
|
type: Input
|
|
5920
6011
|
}], queryParamsHandling: [{
|
|
5921
6012
|
type: Input
|
|
5922
|
-
}], preserveFragment: [{
|
|
5923
|
-
type: Input
|
|
5924
|
-
}], skipLocationChange: [{
|
|
5925
|
-
type: Input
|
|
5926
|
-
}], replaceUrl: [{
|
|
5927
|
-
type: Input
|
|
5928
6013
|
}], state: [{
|
|
5929
6014
|
type: Input
|
|
5930
6015
|
}], relativeTo: [{
|
|
@@ -5932,6 +6017,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
5932
6017
|
}], href: [{
|
|
5933
6018
|
type: HostBinding,
|
|
5934
6019
|
args: ['attr.href']
|
|
6020
|
+
}], preserveFragment: [{
|
|
6021
|
+
type: Input
|
|
6022
|
+
}], skipLocationChange: [{
|
|
6023
|
+
type: Input
|
|
6024
|
+
}], replaceUrl: [{
|
|
6025
|
+
type: Input
|
|
5935
6026
|
}], routerLink: [{
|
|
5936
6027
|
type: Input
|
|
5937
6028
|
}], onClick: [{
|
|
@@ -6130,9 +6221,9 @@ class RouterLinkActive {
|
|
|
6130
6221
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
6131
6222
|
}
|
|
6132
6223
|
}
|
|
6133
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6134
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
6135
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6224
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", 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 });
|
|
6225
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
6226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
6136
6227
|
type: Directive,
|
|
6137
6228
|
args: [{
|
|
6138
6229
|
selector: '[routerLinkActive]',
|
|
@@ -6197,9 +6288,9 @@ class PreloadAllModules {
|
|
|
6197
6288
|
return fn().pipe(catchError(() => of(null)));
|
|
6198
6289
|
}
|
|
6199
6290
|
}
|
|
6200
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6201
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6202
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6291
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6292
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6293
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6203
6294
|
type: Injectable,
|
|
6204
6295
|
args: [{ providedIn: 'root' }]
|
|
6205
6296
|
}] });
|
|
@@ -6217,9 +6308,9 @@ class NoPreloading {
|
|
|
6217
6308
|
return of(null);
|
|
6218
6309
|
}
|
|
6219
6310
|
}
|
|
6220
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6221
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6311
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6312
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6223
6314
|
type: Injectable,
|
|
6224
6315
|
args: [{ providedIn: 'root' }]
|
|
6225
6316
|
}] });
|
|
@@ -6313,10 +6404,11 @@ class RouterPreloader {
|
|
|
6313
6404
|
});
|
|
6314
6405
|
}
|
|
6315
6406
|
}
|
|
6316
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6317
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6319
|
-
type: Injectable
|
|
6407
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6408
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
|
|
6409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6410
|
+
type: Injectable,
|
|
6411
|
+
args: [{ providedIn: 'root' }]
|
|
6320
6412
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6321
6413
|
|
|
6322
6414
|
/**
|
|
@@ -6402,12 +6494,421 @@ class RouterScroller {
|
|
|
6402
6494
|
}
|
|
6403
6495
|
}
|
|
6404
6496
|
}
|
|
6405
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6406
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6407
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6497
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6498
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterScroller });
|
|
6499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6408
6500
|
type: Injectable
|
|
6409
6501
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6410
6502
|
|
|
6503
|
+
/**
|
|
6504
|
+
* @license
|
|
6505
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6506
|
+
*
|
|
6507
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6508
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6509
|
+
*/
|
|
6510
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6511
|
+
/**
|
|
6512
|
+
* Sets up providers necessary to enable `Router` functionality for the application.
|
|
6513
|
+
* Allows to configure a set of routes as well as extra features that should be enabled.
|
|
6514
|
+
*
|
|
6515
|
+
* @usageNotes
|
|
6516
|
+
*
|
|
6517
|
+
* Basic example of how you can add a Router to your application:
|
|
6518
|
+
* ```
|
|
6519
|
+
* const appRoutes: Routes = [];
|
|
6520
|
+
* bootstrapApplication(AppComponent, {
|
|
6521
|
+
* providers: [provideRouter(appRoutes)]
|
|
6522
|
+
* });
|
|
6523
|
+
* ```
|
|
6524
|
+
*
|
|
6525
|
+
* You can also enable optional features in the Router by adding functions from the `RouterFeatures`
|
|
6526
|
+
* type:
|
|
6527
|
+
* ```
|
|
6528
|
+
* const appRoutes: Routes = [];
|
|
6529
|
+
* bootstrapApplication(AppComponent,
|
|
6530
|
+
* {
|
|
6531
|
+
* providers: [
|
|
6532
|
+
* provideRouter(appRoutes,
|
|
6533
|
+
* withDebugTracing(),
|
|
6534
|
+
* withRouterConfig({paramsInheritanceStrategy: 'always'}))
|
|
6535
|
+
* ]
|
|
6536
|
+
* }
|
|
6537
|
+
* );
|
|
6538
|
+
* ```
|
|
6539
|
+
*
|
|
6540
|
+
* @see `RouterFeatures`
|
|
6541
|
+
*
|
|
6542
|
+
* @publicApi
|
|
6543
|
+
* @developerPreview
|
|
6544
|
+
* @param routes A set of `Route`s to use for the application routing table.
|
|
6545
|
+
* @param features Optional features to configure additional router behaviors.
|
|
6546
|
+
* @returns A set of providers to setup a Router.
|
|
6547
|
+
*/
|
|
6548
|
+
function provideRouter(routes, ...features) {
|
|
6549
|
+
return [
|
|
6550
|
+
provideRoutes(routes), { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6551
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
6552
|
+
features.map(feature => feature.ɵproviders),
|
|
6553
|
+
// TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
|
|
6554
|
+
// how we want them to be configured. This API doesn't currently have a way to configure them
|
|
6555
|
+
// and we should decide what the _best_ way to do that is rather than just sticking with the
|
|
6556
|
+
// status quo of how it's done today.
|
|
6557
|
+
];
|
|
6558
|
+
}
|
|
6559
|
+
function rootRoute(router) {
|
|
6560
|
+
return router.routerState.root;
|
|
6561
|
+
}
|
|
6562
|
+
/**
|
|
6563
|
+
* Helper function to create an object that represents a Router feature.
|
|
6564
|
+
*/
|
|
6565
|
+
function routerFeature(kind, providers) {
|
|
6566
|
+
return { ɵkind: kind, ɵproviders: providers };
|
|
6567
|
+
}
|
|
6568
|
+
/**
|
|
6569
|
+
* Registers a [DI provider](guide/glossary#provider) for a set of routes.
|
|
6570
|
+
* @param routes The route configuration to provide.
|
|
6571
|
+
*
|
|
6572
|
+
* @usageNotes
|
|
6573
|
+
*
|
|
6574
|
+
* ```
|
|
6575
|
+
* @NgModule({
|
|
6576
|
+
* providers: [provideRoutes(ROUTES)]
|
|
6577
|
+
* })
|
|
6578
|
+
* class LazyLoadedChildModule {}
|
|
6579
|
+
* ```
|
|
6580
|
+
*
|
|
6581
|
+
* @publicApi
|
|
6582
|
+
*/
|
|
6583
|
+
function provideRoutes(routes) {
|
|
6584
|
+
return [
|
|
6585
|
+
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6586
|
+
];
|
|
6587
|
+
}
|
|
6588
|
+
/**
|
|
6589
|
+
* Enables customizable scrolling behavior for router navigations.
|
|
6590
|
+
*
|
|
6591
|
+
* @usageNotes
|
|
6592
|
+
*
|
|
6593
|
+
* Basic example of how you can enable scrolling feature:
|
|
6594
|
+
* ```
|
|
6595
|
+
* const appRoutes: Routes = [];
|
|
6596
|
+
* bootstrapApplication(AppComponent,
|
|
6597
|
+
* {
|
|
6598
|
+
* providers: [
|
|
6599
|
+
* provideRouter(appRoutes, withInMemoryScrolling())
|
|
6600
|
+
* ]
|
|
6601
|
+
* }
|
|
6602
|
+
* );
|
|
6603
|
+
* ```
|
|
6604
|
+
*
|
|
6605
|
+
* @see `provideRouter`
|
|
6606
|
+
* @see `ViewportScroller`
|
|
6607
|
+
*
|
|
6608
|
+
* @publicApi
|
|
6609
|
+
* @developerPreview
|
|
6610
|
+
* @param options Set of configuration parameters to customize scrolling behavior, see
|
|
6611
|
+
* `InMemoryScrollingOptions` for additional information.
|
|
6612
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6613
|
+
*/
|
|
6614
|
+
function withInMemoryScrolling(options = {}) {
|
|
6615
|
+
const providers = [{
|
|
6616
|
+
provide: ROUTER_SCROLLER,
|
|
6617
|
+
useFactory: () => {
|
|
6618
|
+
const router = inject(Router);
|
|
6619
|
+
const viewportScroller = inject(ViewportScroller);
|
|
6620
|
+
return new RouterScroller(router, viewportScroller, options);
|
|
6621
|
+
},
|
|
6622
|
+
}];
|
|
6623
|
+
return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
|
|
6624
|
+
}
|
|
6625
|
+
function getBootstrapListener() {
|
|
6626
|
+
const injector = inject(Injector);
|
|
6627
|
+
return (bootstrappedComponentRef) => {
|
|
6628
|
+
const ref = injector.get(ApplicationRef);
|
|
6629
|
+
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6630
|
+
return;
|
|
6631
|
+
}
|
|
6632
|
+
const router = injector.get(Router);
|
|
6633
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6634
|
+
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6635
|
+
router.initialNavigation();
|
|
6636
|
+
}
|
|
6637
|
+
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
6638
|
+
injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
|
|
6639
|
+
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6640
|
+
bootstrapDone.next();
|
|
6641
|
+
bootstrapDone.complete();
|
|
6642
|
+
};
|
|
6643
|
+
}
|
|
6644
|
+
/**
|
|
6645
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6646
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6647
|
+
* to the activation phase.
|
|
6648
|
+
*/
|
|
6649
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE$1 ? 'bootstrap done indicator' : '', {
|
|
6650
|
+
factory: () => {
|
|
6651
|
+
return new Subject();
|
|
6652
|
+
}
|
|
6653
|
+
});
|
|
6654
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE$1 ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6655
|
+
/**
|
|
6656
|
+
* Configures initial navigation to start before the root component is created.
|
|
6657
|
+
*
|
|
6658
|
+
* The bootstrap is blocked until the initial navigation is complete. This value is required for
|
|
6659
|
+
* [server-side rendering](guide/universal) to work.
|
|
6660
|
+
*
|
|
6661
|
+
* @usageNotes
|
|
6662
|
+
*
|
|
6663
|
+
* Basic example of how you can enable this navigation behavior:
|
|
6664
|
+
* ```
|
|
6665
|
+
* const appRoutes: Routes = [];
|
|
6666
|
+
* bootstrapApplication(AppComponent,
|
|
6667
|
+
* {
|
|
6668
|
+
* providers: [
|
|
6669
|
+
* provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
|
|
6670
|
+
* ]
|
|
6671
|
+
* }
|
|
6672
|
+
* );
|
|
6673
|
+
* ```
|
|
6674
|
+
*
|
|
6675
|
+
* @see `provideRouter`
|
|
6676
|
+
*
|
|
6677
|
+
* @publicApi
|
|
6678
|
+
* @developerPreview
|
|
6679
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6680
|
+
*/
|
|
6681
|
+
function withEnabledBlockingInitialNavigation() {
|
|
6682
|
+
const providers = [
|
|
6683
|
+
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6684
|
+
{
|
|
6685
|
+
provide: APP_INITIALIZER,
|
|
6686
|
+
multi: true,
|
|
6687
|
+
deps: [Injector],
|
|
6688
|
+
useFactory: (injector) => {
|
|
6689
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());
|
|
6690
|
+
let initNavigation = false;
|
|
6691
|
+
/**
|
|
6692
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6693
|
+
*
|
|
6694
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6695
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6696
|
+
*/
|
|
6697
|
+
function afterNextNavigation(action) {
|
|
6698
|
+
const router = injector.get(Router);
|
|
6699
|
+
router.events
|
|
6700
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6701
|
+
e instanceof NavigationError), map(e => {
|
|
6702
|
+
if (e instanceof NavigationEnd) {
|
|
6703
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6704
|
+
return true;
|
|
6705
|
+
}
|
|
6706
|
+
const redirecting = e instanceof NavigationCancel ?
|
|
6707
|
+
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6708
|
+
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6709
|
+
false;
|
|
6710
|
+
return redirecting ? null : false;
|
|
6711
|
+
}), filter((result) => result !== null), take(1))
|
|
6712
|
+
.subscribe(() => {
|
|
6713
|
+
action();
|
|
6714
|
+
});
|
|
6715
|
+
}
|
|
6716
|
+
return () => {
|
|
6717
|
+
return locationInitialized.then(() => {
|
|
6718
|
+
return new Promise(resolve => {
|
|
6719
|
+
const router = injector.get(Router);
|
|
6720
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6721
|
+
afterNextNavigation(() => {
|
|
6722
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6723
|
+
// without a redirect.
|
|
6724
|
+
resolve(true);
|
|
6725
|
+
initNavigation = true;
|
|
6726
|
+
});
|
|
6727
|
+
router.afterPreactivation = () => {
|
|
6728
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6729
|
+
// assume activation will complete successfully (even though this is not
|
|
6730
|
+
// guaranteed).
|
|
6731
|
+
resolve(true);
|
|
6732
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6733
|
+
if (!initNavigation) {
|
|
6734
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6735
|
+
// subsequent navigations should not be delayed
|
|
6736
|
+
}
|
|
6737
|
+
else {
|
|
6738
|
+
return of(void 0);
|
|
6739
|
+
}
|
|
6740
|
+
};
|
|
6741
|
+
router.initialNavigation();
|
|
6742
|
+
});
|
|
6743
|
+
});
|
|
6744
|
+
};
|
|
6745
|
+
}
|
|
6746
|
+
},
|
|
6747
|
+
];
|
|
6748
|
+
return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);
|
|
6749
|
+
}
|
|
6750
|
+
/**
|
|
6751
|
+
* Disables initial navigation.
|
|
6752
|
+
*
|
|
6753
|
+
* Use if there is a reason to have more control over when the router starts its initial navigation
|
|
6754
|
+
* due to some complex initialization logic.
|
|
6755
|
+
*
|
|
6756
|
+
* @usageNotes
|
|
6757
|
+
*
|
|
6758
|
+
* Basic example of how you can disable initial navigation:
|
|
6759
|
+
* ```
|
|
6760
|
+
* const appRoutes: Routes = [];
|
|
6761
|
+
* bootstrapApplication(AppComponent,
|
|
6762
|
+
* {
|
|
6763
|
+
* providers: [
|
|
6764
|
+
* provideRouter(appRoutes, withDisabledInitialNavigation())
|
|
6765
|
+
* ]
|
|
6766
|
+
* }
|
|
6767
|
+
* );
|
|
6768
|
+
* ```
|
|
6769
|
+
*
|
|
6770
|
+
* @see `provideRouter`
|
|
6771
|
+
*
|
|
6772
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6773
|
+
*
|
|
6774
|
+
* @publicApi
|
|
6775
|
+
* @developerPreview
|
|
6776
|
+
*/
|
|
6777
|
+
function withDisabledInitialNavigation() {
|
|
6778
|
+
const providers = [
|
|
6779
|
+
{
|
|
6780
|
+
provide: APP_INITIALIZER,
|
|
6781
|
+
multi: true,
|
|
6782
|
+
useFactory: () => {
|
|
6783
|
+
const router = inject(Router);
|
|
6784
|
+
return () => {
|
|
6785
|
+
router.setUpLocationChangeListener();
|
|
6786
|
+
};
|
|
6787
|
+
}
|
|
6788
|
+
},
|
|
6789
|
+
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6790
|
+
];
|
|
6791
|
+
return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);
|
|
6792
|
+
}
|
|
6793
|
+
/**
|
|
6794
|
+
* Enables logging of all internal navigation events to the console.
|
|
6795
|
+
* Extra logging might be useful for debugging purposes to inspect Router event sequence.
|
|
6796
|
+
*
|
|
6797
|
+
* @usageNotes
|
|
6798
|
+
*
|
|
6799
|
+
* Basic example of how you can enable debug tracing:
|
|
6800
|
+
* ```
|
|
6801
|
+
* const appRoutes: Routes = [];
|
|
6802
|
+
* bootstrapApplication(AppComponent,
|
|
6803
|
+
* {
|
|
6804
|
+
* providers: [
|
|
6805
|
+
* provideRouter(appRoutes, withDebugTracing())
|
|
6806
|
+
* ]
|
|
6807
|
+
* }
|
|
6808
|
+
* );
|
|
6809
|
+
* ```
|
|
6810
|
+
*
|
|
6811
|
+
* @see `provideRouter`
|
|
6812
|
+
*
|
|
6813
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6814
|
+
*
|
|
6815
|
+
* @publicApi
|
|
6816
|
+
* @developerPreview
|
|
6817
|
+
*/
|
|
6818
|
+
function withDebugTracing() {
|
|
6819
|
+
let providers = [];
|
|
6820
|
+
if (NG_DEV_MODE$1) {
|
|
6821
|
+
providers = [{
|
|
6822
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6823
|
+
multi: true,
|
|
6824
|
+
useFactory: () => {
|
|
6825
|
+
const router = inject(Router);
|
|
6826
|
+
return () => router.events.subscribe((e) => {
|
|
6827
|
+
// tslint:disable:no-console
|
|
6828
|
+
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6829
|
+
console.log(stringifyEvent(e));
|
|
6830
|
+
console.log(e);
|
|
6831
|
+
console.groupEnd?.();
|
|
6832
|
+
// tslint:enable:no-console
|
|
6833
|
+
});
|
|
6834
|
+
}
|
|
6835
|
+
}];
|
|
6836
|
+
}
|
|
6837
|
+
else {
|
|
6838
|
+
providers = [];
|
|
6839
|
+
}
|
|
6840
|
+
return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
|
|
6841
|
+
}
|
|
6842
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE$1 ? 'router preloader' : '');
|
|
6843
|
+
/**
|
|
6844
|
+
* Allows to configure a preloading strategy to use. The strategy is configured by providing a
|
|
6845
|
+
* reference to a class that implements a `PreloadingStrategy`.
|
|
6846
|
+
*
|
|
6847
|
+
* @usageNotes
|
|
6848
|
+
*
|
|
6849
|
+
* Basic example of how you can configure preloading:
|
|
6850
|
+
* ```
|
|
6851
|
+
* const appRoutes: Routes = [];
|
|
6852
|
+
* bootstrapApplication(AppComponent,
|
|
6853
|
+
* {
|
|
6854
|
+
* providers: [
|
|
6855
|
+
* provideRouter(appRoutes, withPreloading(PreloadAllModules))
|
|
6856
|
+
* ]
|
|
6857
|
+
* }
|
|
6858
|
+
* );
|
|
6859
|
+
* ```
|
|
6860
|
+
*
|
|
6861
|
+
* @see `provideRouter`
|
|
6862
|
+
*
|
|
6863
|
+
* @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
|
|
6864
|
+
* should be used.
|
|
6865
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6866
|
+
*
|
|
6867
|
+
* @publicApi
|
|
6868
|
+
* @developerPreview
|
|
6869
|
+
*/
|
|
6870
|
+
function withPreloading(preloadingStrategy) {
|
|
6871
|
+
const providers = [
|
|
6872
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6873
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6874
|
+
];
|
|
6875
|
+
return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);
|
|
6876
|
+
}
|
|
6877
|
+
/**
|
|
6878
|
+
* Allows to provide extra parameters to configure Router.
|
|
6879
|
+
*
|
|
6880
|
+
* @usageNotes
|
|
6881
|
+
*
|
|
6882
|
+
* Basic example of how you can provide extra configuration options:
|
|
6883
|
+
* ```
|
|
6884
|
+
* const appRoutes: Routes = [];
|
|
6885
|
+
* bootstrapApplication(AppComponent,
|
|
6886
|
+
* {
|
|
6887
|
+
* providers: [
|
|
6888
|
+
* provideRouter(appRoutes, withRouterConfig({
|
|
6889
|
+
* onSameUrlNavigation: 'reload'
|
|
6890
|
+
* }))
|
|
6891
|
+
* ]
|
|
6892
|
+
* }
|
|
6893
|
+
* );
|
|
6894
|
+
* ```
|
|
6895
|
+
*
|
|
6896
|
+
* @see `provideRouter`
|
|
6897
|
+
*
|
|
6898
|
+
* @param options A set of parameters to configure Router, see `RouterConfigOptions` for
|
|
6899
|
+
* additional information.
|
|
6900
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6901
|
+
*
|
|
6902
|
+
* @publicApi
|
|
6903
|
+
* @developerPreview
|
|
6904
|
+
*/
|
|
6905
|
+
function withRouterConfig(options) {
|
|
6906
|
+
const providers = [
|
|
6907
|
+
{ provide: ROUTER_CONFIGURATION, useValue: options },
|
|
6908
|
+
];
|
|
6909
|
+
return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);
|
|
6910
|
+
}
|
|
6911
|
+
|
|
6411
6912
|
/**
|
|
6412
6913
|
* @license
|
|
6413
6914
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6424,7 +6925,6 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6424
6925
|
* @docsNotRequired
|
|
6425
6926
|
*/
|
|
6426
6927
|
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6427
|
-
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6428
6928
|
// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
|
|
6429
6929
|
// here to avoid a breaking change whereby the provider order matters based on where the
|
|
6430
6930
|
// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
|
|
@@ -6437,9 +6937,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6437
6937
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6438
6938
|
RouterConfigLoader,
|
|
6439
6939
|
];
|
|
6440
|
-
function rootRoute(router) {
|
|
6441
|
-
return router.routerState.root;
|
|
6442
|
-
}
|
|
6443
6940
|
function routerNgProbeToken() {
|
|
6444
6941
|
return new NgProbeToken('Router', Router);
|
|
6445
6942
|
}
|
|
@@ -6489,7 +6986,7 @@ class RouterModule {
|
|
|
6489
6986
|
ngModule: RouterModule,
|
|
6490
6987
|
providers: [
|
|
6491
6988
|
ROUTER_PROVIDERS,
|
|
6492
|
-
NG_DEV_MODE ? (config?.enableTracing ?
|
|
6989
|
+
NG_DEV_MODE ? (config?.enableTracing ? withDebugTracing().ɵproviders : []) : [],
|
|
6493
6990
|
provideRoutes(routes),
|
|
6494
6991
|
{
|
|
6495
6992
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6499,7 +6996,7 @@ class RouterModule {
|
|
|
6499
6996
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6500
6997
|
config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6501
6998
|
provideRouterScroller(),
|
|
6502
|
-
config?.preloadingStrategy ?
|
|
6999
|
+
config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).ɵproviders : [],
|
|
6503
7000
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6504
7001
|
config?.initialNavigation ? provideInitialNavigation(config) : [],
|
|
6505
7002
|
provideRouterInitializer(),
|
|
@@ -6526,10 +7023,10 @@ class RouterModule {
|
|
|
6526
7023
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6527
7024
|
}
|
|
6528
7025
|
}
|
|
6529
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6530
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
6531
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
6532
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
7026
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
7027
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
7028
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
|
|
7029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterModule, decorators: [{
|
|
6533
7030
|
type: NgModule,
|
|
6534
7031
|
args: [{
|
|
6535
7032
|
imports: ROUTER_DIRECTIVES,
|
|
@@ -6541,6 +7038,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
6541
7038
|
type: Inject,
|
|
6542
7039
|
args: [ROUTER_FORROOT_GUARD]
|
|
6543
7040
|
}] }]; } });
|
|
7041
|
+
/**
|
|
7042
|
+
* For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`
|
|
7043
|
+
* because it reads from the `ExtraOptions` which should not be used in the standalone world.
|
|
7044
|
+
*/
|
|
6544
7045
|
function provideRouterScroller() {
|
|
6545
7046
|
return {
|
|
6546
7047
|
provide: ROUTER_SCROLLER,
|
|
@@ -6555,58 +7056,33 @@ function provideRouterScroller() {
|
|
|
6555
7056
|
},
|
|
6556
7057
|
};
|
|
6557
7058
|
}
|
|
7059
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should
|
|
7060
|
+
// provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.
|
|
6558
7061
|
function provideHashLocationStrategy() {
|
|
6559
7062
|
return { provide: LocationStrategy, useClass: HashLocationStrategy };
|
|
6560
7063
|
}
|
|
7064
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not
|
|
7065
|
+
// need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.
|
|
6561
7066
|
function providePathLocationStrategy() {
|
|
6562
7067
|
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6563
7068
|
}
|
|
6564
7069
|
function provideForRootGuard(router) {
|
|
6565
7070
|
if (NG_DEV_MODE && router) {
|
|
6566
|
-
throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `
|
|
7071
|
+
throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector.` +
|
|
7072
|
+
` Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6567
7073
|
}
|
|
6568
7074
|
return 'guarded';
|
|
6569
7075
|
}
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
*
|
|
6574
|
-
* @usageNotes
|
|
6575
|
-
*
|
|
6576
|
-
* ```
|
|
6577
|
-
* @NgModule({
|
|
6578
|
-
* imports: [RouterModule.forChild(ROUTES)],
|
|
6579
|
-
* providers: [provideRoutes(EXTRA_ROUTES)]
|
|
6580
|
-
* })
|
|
6581
|
-
* class MyNgModule {}
|
|
6582
|
-
* ```
|
|
6583
|
-
*
|
|
6584
|
-
* @publicApi
|
|
6585
|
-
*/
|
|
6586
|
-
function provideRoutes(routes) {
|
|
7076
|
+
// Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`
|
|
7077
|
+
// users call `withXInitialNavigation` directly.
|
|
7078
|
+
function provideInitialNavigation(config) {
|
|
6587
7079
|
return [
|
|
6588
|
-
|
|
7080
|
+
config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [],
|
|
7081
|
+
config.initialNavigation === 'enabledBlocking' ?
|
|
7082
|
+
withEnabledBlockingInitialNavigation().ɵproviders :
|
|
7083
|
+
[],
|
|
6589
7084
|
];
|
|
6590
7085
|
}
|
|
6591
|
-
function getBootstrapListener() {
|
|
6592
|
-
const injector = inject(Injector);
|
|
6593
|
-
return (bootstrappedComponentRef) => {
|
|
6594
|
-
const ref = injector.get(ApplicationRef);
|
|
6595
|
-
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6596
|
-
return;
|
|
6597
|
-
}
|
|
6598
|
-
const router = injector.get(Router);
|
|
6599
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6600
|
-
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6601
|
-
router.initialNavigation();
|
|
6602
|
-
}
|
|
6603
|
-
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
6604
|
-
injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
|
|
6605
|
-
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6606
|
-
bootstrapDone.next();
|
|
6607
|
-
bootstrapDone.complete();
|
|
6608
|
-
};
|
|
6609
|
-
}
|
|
6610
7086
|
// TODO(atscott): This should not be in the public API
|
|
6611
7087
|
/**
|
|
6612
7088
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
@@ -6615,12 +7091,6 @@ function getBootstrapListener() {
|
|
|
6615
7091
|
* @publicApi
|
|
6616
7092
|
*/
|
|
6617
7093
|
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6618
|
-
function provideInitialNavigation(config) {
|
|
6619
|
-
return [
|
|
6620
|
-
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6621
|
-
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6622
|
-
];
|
|
6623
|
-
}
|
|
6624
7094
|
function provideRouterInitializer() {
|
|
6625
7095
|
return [
|
|
6626
7096
|
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
@@ -6629,129 +7099,6 @@ function provideRouterInitializer() {
|
|
|
6629
7099
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6630
7100
|
];
|
|
6631
7101
|
}
|
|
6632
|
-
/**
|
|
6633
|
-
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6634
|
-
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6635
|
-
* to the activation phase.
|
|
6636
|
-
*/
|
|
6637
|
-
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6638
|
-
factory: () => {
|
|
6639
|
-
return new Subject();
|
|
6640
|
-
}
|
|
6641
|
-
});
|
|
6642
|
-
function provideEnabledBlockingInitialNavigation() {
|
|
6643
|
-
return [
|
|
6644
|
-
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6645
|
-
{
|
|
6646
|
-
provide: APP_INITIALIZER,
|
|
6647
|
-
multi: true,
|
|
6648
|
-
deps: [Injector],
|
|
6649
|
-
useFactory: (injector) => {
|
|
6650
|
-
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6651
|
-
let initNavigation = false;
|
|
6652
|
-
/**
|
|
6653
|
-
* Performs the given action once the router finishes its next/current navigation.
|
|
6654
|
-
*
|
|
6655
|
-
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6656
|
-
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6657
|
-
*/
|
|
6658
|
-
function afterNextNavigation(action) {
|
|
6659
|
-
const router = injector.get(Router);
|
|
6660
|
-
router.events
|
|
6661
|
-
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6662
|
-
e instanceof NavigationError), map(e => {
|
|
6663
|
-
if (e instanceof NavigationEnd) {
|
|
6664
|
-
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6665
|
-
return true;
|
|
6666
|
-
}
|
|
6667
|
-
const redirecting = e instanceof NavigationCancel ?
|
|
6668
|
-
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6669
|
-
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6670
|
-
false;
|
|
6671
|
-
return redirecting ? null : false;
|
|
6672
|
-
}), filter((result) => result !== null), take(1))
|
|
6673
|
-
.subscribe(() => {
|
|
6674
|
-
action();
|
|
6675
|
-
});
|
|
6676
|
-
}
|
|
6677
|
-
return () => {
|
|
6678
|
-
return locationInitialized.then(() => {
|
|
6679
|
-
return new Promise(resolve => {
|
|
6680
|
-
const router = injector.get(Router);
|
|
6681
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6682
|
-
afterNextNavigation(() => {
|
|
6683
|
-
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6684
|
-
// without a redirect.
|
|
6685
|
-
resolve(true);
|
|
6686
|
-
initNavigation = true;
|
|
6687
|
-
});
|
|
6688
|
-
router.afterPreactivation = () => {
|
|
6689
|
-
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6690
|
-
// assume activation will complete successfully (even though this is not
|
|
6691
|
-
// guaranteed).
|
|
6692
|
-
resolve(true);
|
|
6693
|
-
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6694
|
-
if (!initNavigation) {
|
|
6695
|
-
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6696
|
-
// subsequent navigations should not be delayed
|
|
6697
|
-
}
|
|
6698
|
-
else {
|
|
6699
|
-
return of(void 0);
|
|
6700
|
-
}
|
|
6701
|
-
};
|
|
6702
|
-
router.initialNavigation();
|
|
6703
|
-
});
|
|
6704
|
-
});
|
|
6705
|
-
};
|
|
6706
|
-
}
|
|
6707
|
-
},
|
|
6708
|
-
];
|
|
6709
|
-
}
|
|
6710
|
-
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6711
|
-
function provideDisabledInitialNavigation() {
|
|
6712
|
-
return [
|
|
6713
|
-
{
|
|
6714
|
-
provide: APP_INITIALIZER,
|
|
6715
|
-
multi: true,
|
|
6716
|
-
useFactory: () => {
|
|
6717
|
-
const router = inject(Router);
|
|
6718
|
-
return () => {
|
|
6719
|
-
router.setUpLocationChangeListener();
|
|
6720
|
-
};
|
|
6721
|
-
}
|
|
6722
|
-
},
|
|
6723
|
-
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6724
|
-
];
|
|
6725
|
-
}
|
|
6726
|
-
function provideTracing() {
|
|
6727
|
-
if (NG_DEV_MODE) {
|
|
6728
|
-
return [{
|
|
6729
|
-
provide: ENVIRONMENT_INITIALIZER,
|
|
6730
|
-
multi: true,
|
|
6731
|
-
useFactory: () => {
|
|
6732
|
-
const router = inject(Router);
|
|
6733
|
-
return () => router.events.subscribe((e) => {
|
|
6734
|
-
// tslint:disable:no-console
|
|
6735
|
-
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6736
|
-
console.log(stringifyEvent(e));
|
|
6737
|
-
console.log(e);
|
|
6738
|
-
console.groupEnd?.();
|
|
6739
|
-
// tslint:enable:no-console
|
|
6740
|
-
});
|
|
6741
|
-
}
|
|
6742
|
-
}];
|
|
6743
|
-
}
|
|
6744
|
-
else {
|
|
6745
|
-
return [];
|
|
6746
|
-
}
|
|
6747
|
-
}
|
|
6748
|
-
function providePreloading(preloadingStrategy) {
|
|
6749
|
-
return [
|
|
6750
|
-
RouterPreloader,
|
|
6751
|
-
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6752
|
-
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6753
|
-
];
|
|
6754
|
-
}
|
|
6755
7102
|
|
|
6756
7103
|
/**
|
|
6757
7104
|
* @license
|
|
@@ -6763,7 +7110,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6763
7110
|
/**
|
|
6764
7111
|
* @publicApi
|
|
6765
7112
|
*/
|
|
6766
|
-
const VERSION = new Version('14.2.
|
|
7113
|
+
const VERSION = new Version('14.2.1');
|
|
6767
7114
|
|
|
6768
7115
|
/**
|
|
6769
7116
|
* @license
|
|
@@ -6802,5 +7149,5 @@ const VERSION = new Version('14.2.0-next.1');
|
|
|
6802
7149
|
* Generated bundle index. Do not edit.
|
|
6803
7150
|
*/
|
|
6804
7151
|
|
|
6805
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten,
|
|
7152
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
|
|
6806
7153
|
//# sourceMappingURL=router.mjs.map
|