@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/fesm2015/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
|
*
|
|
@@ -1004,11 +1004,11 @@ class Navigation {
|
|
|
1004
1004
|
this.numberOfDoubleDots = numberOfDoubleDots;
|
|
1005
1005
|
this.commands = commands;
|
|
1006
1006
|
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
|
1007
|
-
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$
|
|
1007
|
+
throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
|
|
1008
1008
|
}
|
|
1009
1009
|
const cmdWithOutlet = commands.find(isCommandWithOutlets);
|
|
1010
1010
|
if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
|
1011
|
-
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$
|
|
1011
|
+
throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
1014
|
toRoot() {
|
|
@@ -1107,7 +1107,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
|
|
1107
1107
|
dd -= ci;
|
|
1108
1108
|
g = g.parent;
|
|
1109
1109
|
if (!g) {
|
|
1110
|
-
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$
|
|
1110
|
+
throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
|
|
1111
1111
|
}
|
|
1112
1112
|
ci = g.segments.length;
|
|
1113
1113
|
}
|
|
@@ -2388,9 +2388,9 @@ class ChildrenOutletContexts {
|
|
|
2388
2388
|
return this.contexts.get(childName) || null;
|
|
2389
2389
|
}
|
|
2390
2390
|
}
|
|
2391
|
-
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
2392
|
-
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
2393
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
2391
|
+
ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2392
|
+
ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
|
|
2393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
|
|
2394
2394
|
type: Injectable,
|
|
2395
2395
|
args: [{ providedIn: 'root' }]
|
|
2396
2396
|
}] });
|
|
@@ -2402,7 +2402,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
2402
2402
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2403
2403
|
* found in the LICENSE file at https://angular.io/license
|
|
2404
2404
|
*/
|
|
2405
|
-
const NG_DEV_MODE$
|
|
2405
|
+
const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
2406
2406
|
/**
|
|
2407
2407
|
* @description
|
|
2408
2408
|
*
|
|
@@ -2512,12 +2512,12 @@ class RouterOutlet {
|
|
|
2512
2512
|
*/
|
|
2513
2513
|
get component() {
|
|
2514
2514
|
if (!this.activated)
|
|
2515
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2515
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2516
2516
|
return this.activated.instance;
|
|
2517
2517
|
}
|
|
2518
2518
|
get activatedRoute() {
|
|
2519
2519
|
if (!this.activated)
|
|
2520
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2520
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2521
2521
|
return this._activatedRoute;
|
|
2522
2522
|
}
|
|
2523
2523
|
get activatedRouteData() {
|
|
@@ -2531,7 +2531,7 @@ class RouterOutlet {
|
|
|
2531
2531
|
*/
|
|
2532
2532
|
detach() {
|
|
2533
2533
|
if (!this.activated)
|
|
2534
|
-
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$
|
|
2534
|
+
throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
|
|
2535
2535
|
this.location.detach();
|
|
2536
2536
|
const cmp = this.activated;
|
|
2537
2537
|
this.activated = null;
|
|
@@ -2559,7 +2559,7 @@ class RouterOutlet {
|
|
|
2559
2559
|
}
|
|
2560
2560
|
activateWith(activatedRoute, resolverOrInjector) {
|
|
2561
2561
|
if (this.isActivated) {
|
|
2562
|
-
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$
|
|
2562
|
+
throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
|
|
2563
2563
|
}
|
|
2564
2564
|
this._activatedRoute = activatedRoute;
|
|
2565
2565
|
const location = this.location;
|
|
@@ -2581,9 +2581,9 @@ class RouterOutlet {
|
|
|
2581
2581
|
this.activateEvents.emit(this.activated.instance);
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
2585
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
2586
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
2584
|
+
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 });
|
|
2585
|
+
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 });
|
|
2586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2587
2587
|
type: Directive,
|
|
2588
2588
|
args: [{
|
|
2589
2589
|
selector: 'router-outlet',
|
|
@@ -2646,9 +2646,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2646
2646
|
*/
|
|
2647
2647
|
class ɵEmptyOutletComponent {
|
|
2648
2648
|
}
|
|
2649
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
2650
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.
|
|
2651
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
2649
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2650
|
+
ɵ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"] }] });
|
|
2651
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2652
2652
|
type: Component,
|
|
2653
2653
|
args: [{
|
|
2654
2654
|
template: `<router-outlet></router-outlet>`,
|
|
@@ -3574,7 +3574,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
|
|
|
3574
3574
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3575
3575
|
* found in the LICENSE file at https://angular.io/license
|
|
3576
3576
|
*/
|
|
3577
|
-
const NG_DEV_MODE$
|
|
3577
|
+
const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
3578
3578
|
class NoMatch$1 {
|
|
3579
3579
|
constructor(segmentGroup) {
|
|
3580
3580
|
this.segmentGroup = segmentGroup || null;
|
|
@@ -3592,11 +3592,11 @@ function absoluteRedirect(newTree) {
|
|
|
3592
3592
|
return throwError(new AbsoluteRedirect(newTree));
|
|
3593
3593
|
}
|
|
3594
3594
|
function namedOutletsRedirect(redirectTo) {
|
|
3595
|
-
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$
|
|
3595
|
+
return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3596
3596
|
`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
|
|
3597
3597
|
}
|
|
3598
3598
|
function canLoadFails(route) {
|
|
3599
|
-
return throwError(navigationCancelingError(NG_DEV_MODE$
|
|
3599
|
+
return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
|
|
3600
3600
|
`Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
|
|
3601
3601
|
}
|
|
3602
3602
|
/**
|
|
@@ -3656,7 +3656,7 @@ class ApplyRedirects {
|
|
|
3656
3656
|
}));
|
|
3657
3657
|
}
|
|
3658
3658
|
noMatchError(e) {
|
|
3659
|
-
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$
|
|
3659
|
+
return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
|
|
3660
3660
|
}
|
|
3661
3661
|
createUrlTree(rootCandidate, queryParams, fragment) {
|
|
3662
3662
|
const root = createRoot(rootCandidate);
|
|
@@ -3873,7 +3873,7 @@ class ApplyRedirects {
|
|
|
3873
3873
|
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
|
|
3874
3874
|
const pos = posParams[redirectToUrlSegment.path.substring(1)];
|
|
3875
3875
|
if (!pos)
|
|
3876
|
-
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$
|
|
3876
|
+
throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
|
|
3877
3877
|
`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
|
|
3878
3878
|
return pos;
|
|
3879
3879
|
}
|
|
@@ -3909,7 +3909,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
|
|
|
3909
3909
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3910
3910
|
* found in the LICENSE file at https://angular.io/license
|
|
3911
3911
|
*/
|
|
3912
|
-
const NG_DEV_MODE$
|
|
3912
|
+
const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3913
3913
|
class NoMatch {
|
|
3914
3914
|
}
|
|
3915
3915
|
function newObservableError(e) {
|
|
@@ -3998,7 +3998,7 @@ class Recognizer {
|
|
|
3998
3998
|
// multiple activated results for the same outlet. We should merge the children of
|
|
3999
3999
|
// these results so the final return value is only one `TreeNode` per outlet.
|
|
4000
4000
|
const mergedChildren = mergeEmptyPathMatches(children);
|
|
4001
|
-
if (NG_DEV_MODE$
|
|
4001
|
+
if (NG_DEV_MODE$5) {
|
|
4002
4002
|
// This should really never happen - we are only taking the first match for each
|
|
4003
4003
|
// outlet and merge the empty path matches.
|
|
4004
4004
|
checkOutletNameUniqueness(mergedChildren);
|
|
@@ -4033,7 +4033,7 @@ class Recognizer {
|
|
|
4033
4033
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
4034
4034
|
// production bundle size. This value is intended only to surface a warning to users
|
|
4035
4035
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
4036
|
-
(NG_DEV_MODE$
|
|
4036
|
+
(NG_DEV_MODE$5 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
4037
4037
|
pathIndexShift));
|
|
4038
4038
|
matchResult = of({
|
|
4039
4039
|
snapshot,
|
|
@@ -4050,7 +4050,7 @@ class Recognizer {
|
|
|
4050
4050
|
return null;
|
|
4051
4051
|
}
|
|
4052
4052
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
4053
|
-
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$
|
|
4053
|
+
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$5 ?
|
|
4054
4054
|
getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
4055
4055
|
pathIndexShift));
|
|
4056
4056
|
return { snapshot, consumedSegments, remainingSegments };
|
|
@@ -4164,7 +4164,7 @@ function checkOutletNameUniqueness(nodes) {
|
|
|
4164
4164
|
if (routeWithSameOutletName) {
|
|
4165
4165
|
const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
|
|
4166
4166
|
const c = n.value.url.map(s => s.toString()).join('/');
|
|
4167
|
-
throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$
|
|
4167
|
+
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}'.`);
|
|
4168
4168
|
}
|
|
4169
4169
|
names[n.value.outlet] = n.value;
|
|
4170
4170
|
});
|
|
@@ -4350,9 +4350,9 @@ class TitleStrategy {
|
|
|
4350
4350
|
return snapshot.data[RouteTitleKey];
|
|
4351
4351
|
}
|
|
4352
4352
|
}
|
|
4353
|
-
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
4354
|
-
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
4355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
4353
|
+
TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4354
|
+
TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
|
|
4355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: TitleStrategy, decorators: [{
|
|
4356
4356
|
type: Injectable,
|
|
4357
4357
|
args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
|
|
4358
4358
|
}] });
|
|
@@ -4376,13 +4376,25 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
4376
4376
|
}
|
|
4377
4377
|
}
|
|
4378
4378
|
}
|
|
4379
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
4380
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
4381
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
4379
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4380
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
4381
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
4382
4382
|
type: Injectable,
|
|
4383
4383
|
args: [{ providedIn: 'root' }]
|
|
4384
4384
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
4385
4385
|
|
|
4386
|
+
/**
|
|
4387
|
+
* @license
|
|
4388
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4389
|
+
*
|
|
4390
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4391
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4392
|
+
*/
|
|
4393
|
+
/**
|
|
4394
|
+
* Exists to aid internal migration off of the deprecated relativeLinkResolution option.
|
|
4395
|
+
*/
|
|
4396
|
+
function assignRelativeLinkResolution(router) { }
|
|
4397
|
+
|
|
4386
4398
|
/**
|
|
4387
4399
|
* @license
|
|
4388
4400
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -4455,13 +4467,13 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4455
4467
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4456
4468
|
* found in the LICENSE file at https://angular.io/license
|
|
4457
4469
|
*/
|
|
4458
|
-
const NG_DEV_MODE$
|
|
4470
|
+
const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4459
4471
|
/**
|
|
4460
4472
|
* A [DI token](guide/glossary/#di-token) for the router service.
|
|
4461
4473
|
*
|
|
4462
4474
|
* @publicApi
|
|
4463
4475
|
*/
|
|
4464
|
-
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$
|
|
4476
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
|
|
4465
4477
|
providedIn: 'root',
|
|
4466
4478
|
factory: () => ({}),
|
|
4467
4479
|
});
|
|
@@ -4473,7 +4485,7 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config'
|
|
|
4473
4485
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4474
4486
|
* found in the LICENSE file at https://angular.io/license
|
|
4475
4487
|
*/
|
|
4476
|
-
const NG_DEV_MODE$
|
|
4488
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4477
4489
|
/**
|
|
4478
4490
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4479
4491
|
*
|
|
@@ -4508,7 +4520,7 @@ class RouterConfigLoader {
|
|
|
4508
4520
|
if (this.onLoadEndListener) {
|
|
4509
4521
|
this.onLoadEndListener(route);
|
|
4510
4522
|
}
|
|
4511
|
-
NG_DEV_MODE$
|
|
4523
|
+
NG_DEV_MODE$3 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
|
|
4512
4524
|
route._loadedComponent = component;
|
|
4513
4525
|
}), finalize(() => {
|
|
4514
4526
|
this.componentLoaders.delete(route);
|
|
@@ -4551,7 +4563,7 @@ class RouterConfigLoader {
|
|
|
4551
4563
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4552
4564
|
}
|
|
4553
4565
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4554
|
-
NG_DEV_MODE$
|
|
4566
|
+
NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4555
4567
|
return { routes, injector };
|
|
4556
4568
|
}), finalize(() => {
|
|
4557
4569
|
this.childrenLoaders.delete(route);
|
|
@@ -4573,9 +4585,9 @@ class RouterConfigLoader {
|
|
|
4573
4585
|
}));
|
|
4574
4586
|
}
|
|
4575
4587
|
}
|
|
4576
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
4577
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
4578
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
4588
|
+
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 });
|
|
4589
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
|
|
4590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4579
4591
|
type: Injectable,
|
|
4580
4592
|
args: [{ providedIn: 'root' }]
|
|
4581
4593
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
@@ -4618,7 +4630,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4618
4630
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4619
4631
|
* found in the LICENSE file at https://angular.io/license
|
|
4620
4632
|
*/
|
|
4621
|
-
const NG_DEV_MODE$
|
|
4633
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4622
4634
|
function defaultErrorHandler(error) {
|
|
4623
4635
|
throw error;
|
|
4624
4636
|
}
|
|
@@ -4690,6 +4702,7 @@ function setupRouter() {
|
|
|
4690
4702
|
}
|
|
4691
4703
|
router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
|
|
4692
4704
|
assignExtraOptionsToRouter(opts, router);
|
|
4705
|
+
assignRelativeLinkResolution(router);
|
|
4693
4706
|
return router;
|
|
4694
4707
|
}
|
|
4695
4708
|
/**
|
|
@@ -5012,7 +5025,7 @@ class Router {
|
|
|
5012
5025
|
complete: () => {
|
|
5013
5026
|
if (!dataResolved) {
|
|
5014
5027
|
this.restoreHistory(t);
|
|
5015
|
-
this.cancelNavigationTransition(t, NG_DEV_MODE$
|
|
5028
|
+
this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
|
|
5016
5029
|
`At least one route resolver didn't emit any value.` :
|
|
5017
5030
|
'', 2 /* NavigationCancellationCode.NoDataFromResolver */);
|
|
5018
5031
|
}
|
|
@@ -5081,7 +5094,7 @@ class Router {
|
|
|
5081
5094
|
* catch-all to make sure the NavigationCancel event is fired when a
|
|
5082
5095
|
* navigation gets cancelled but not caught by other means. */
|
|
5083
5096
|
if (!completed && !errored) {
|
|
5084
|
-
const cancelationReason = NG_DEV_MODE$
|
|
5097
|
+
const cancelationReason = NG_DEV_MODE$2 ?
|
|
5085
5098
|
`Navigation ID ${overallTransitionState
|
|
5086
5099
|
.id} is not equal to the current navigation id ${this.navigationId}` :
|
|
5087
5100
|
'';
|
|
@@ -5241,7 +5254,7 @@ class Router {
|
|
|
5241
5254
|
* ```
|
|
5242
5255
|
*/
|
|
5243
5256
|
resetConfig(config) {
|
|
5244
|
-
NG_DEV_MODE$
|
|
5257
|
+
NG_DEV_MODE$2 && validateConfig(config);
|
|
5245
5258
|
this.config = config.map(standardizeConfig);
|
|
5246
5259
|
this.navigated = false;
|
|
5247
5260
|
this.lastSuccessfulId = -1;
|
|
@@ -5599,9 +5612,9 @@ class Router {
|
|
|
5599
5612
|
return { navigationId };
|
|
5600
5613
|
}
|
|
5601
5614
|
}
|
|
5602
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
5603
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
5604
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
5615
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5616
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
|
|
5617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Router, decorators: [{
|
|
5605
5618
|
type: Injectable,
|
|
5606
5619
|
args: [{
|
|
5607
5620
|
providedIn: 'root',
|
|
@@ -5612,7 +5625,7 @@ function validateCommands(commands) {
|
|
|
5612
5625
|
for (let i = 0; i < commands.length; i++) {
|
|
5613
5626
|
const cmd = commands[i];
|
|
5614
5627
|
if (cmd == null) {
|
|
5615
|
-
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$
|
|
5628
|
+
throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$2 && `The requested path contains ${cmd} segment at index ${i}`);
|
|
5616
5629
|
}
|
|
5617
5630
|
}
|
|
5618
5631
|
}
|
|
@@ -5724,11 +5737,50 @@ class RouterLink {
|
|
|
5724
5737
|
this.tabIndexAttribute = tabIndexAttribute;
|
|
5725
5738
|
this.renderer = renderer;
|
|
5726
5739
|
this.el = el;
|
|
5740
|
+
this._preserveFragment = false;
|
|
5741
|
+
this._skipLocationChange = false;
|
|
5742
|
+
this._replaceUrl = false;
|
|
5727
5743
|
this.commands = null;
|
|
5728
5744
|
/** @internal */
|
|
5729
5745
|
this.onChanges = new Subject();
|
|
5730
5746
|
this.setTabIndexIfNotOnNativeEl('0');
|
|
5731
5747
|
}
|
|
5748
|
+
/**
|
|
5749
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5750
|
+
* `UrlCreationOptions`.
|
|
5751
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5752
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5753
|
+
*/
|
|
5754
|
+
set preserveFragment(preserveFragment) {
|
|
5755
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5756
|
+
}
|
|
5757
|
+
get preserveFragment() {
|
|
5758
|
+
return this._preserveFragment;
|
|
5759
|
+
}
|
|
5760
|
+
/**
|
|
5761
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5762
|
+
* `NavigationBehaviorOptions`.
|
|
5763
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5764
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5765
|
+
*/
|
|
5766
|
+
set skipLocationChange(skipLocationChange) {
|
|
5767
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5768
|
+
}
|
|
5769
|
+
get skipLocationChange() {
|
|
5770
|
+
return this._skipLocationChange;
|
|
5771
|
+
}
|
|
5772
|
+
/**
|
|
5773
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5774
|
+
* `NavigationBehaviorOptions`.
|
|
5775
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5776
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5777
|
+
*/
|
|
5778
|
+
set replaceUrl(replaceUrl) {
|
|
5779
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5780
|
+
}
|
|
5781
|
+
get replaceUrl() {
|
|
5782
|
+
return this._replaceUrl;
|
|
5783
|
+
}
|
|
5732
5784
|
/**
|
|
5733
5785
|
* Modifies the tab index if there was not a tabindex attribute on the element during
|
|
5734
5786
|
* instantiation.
|
|
@@ -5775,8 +5827,8 @@ class RouterLink {
|
|
|
5775
5827
|
return true;
|
|
5776
5828
|
}
|
|
5777
5829
|
const extras = {
|
|
5778
|
-
skipLocationChange:
|
|
5779
|
-
replaceUrl:
|
|
5830
|
+
skipLocationChange: this.skipLocationChange,
|
|
5831
|
+
replaceUrl: this.replaceUrl,
|
|
5780
5832
|
state: this.state,
|
|
5781
5833
|
};
|
|
5782
5834
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5793,13 +5845,13 @@ class RouterLink {
|
|
|
5793
5845
|
queryParams: this.queryParams,
|
|
5794
5846
|
fragment: this.fragment,
|
|
5795
5847
|
queryParamsHandling: this.queryParamsHandling,
|
|
5796
|
-
preserveFragment:
|
|
5848
|
+
preserveFragment: this.preserveFragment,
|
|
5797
5849
|
});
|
|
5798
5850
|
}
|
|
5799
5851
|
}
|
|
5800
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
5801
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
5802
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
5852
|
+
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 });
|
|
5853
|
+
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 });
|
|
5854
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLink, decorators: [{
|
|
5803
5855
|
type: Directive,
|
|
5804
5856
|
args: [{
|
|
5805
5857
|
selector: ':not(a):not(area)[routerLink]',
|
|
@@ -5816,16 +5868,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
5816
5868
|
type: Input
|
|
5817
5869
|
}], queryParamsHandling: [{
|
|
5818
5870
|
type: Input
|
|
5871
|
+
}], state: [{
|
|
5872
|
+
type: Input
|
|
5873
|
+
}], relativeTo: [{
|
|
5874
|
+
type: Input
|
|
5819
5875
|
}], preserveFragment: [{
|
|
5820
5876
|
type: Input
|
|
5821
5877
|
}], skipLocationChange: [{
|
|
5822
5878
|
type: Input
|
|
5823
5879
|
}], replaceUrl: [{
|
|
5824
5880
|
type: Input
|
|
5825
|
-
}], state: [{
|
|
5826
|
-
type: Input
|
|
5827
|
-
}], relativeTo: [{
|
|
5828
|
-
type: Input
|
|
5829
5881
|
}], routerLink: [{
|
|
5830
5882
|
type: Input
|
|
5831
5883
|
}], onClick: [{
|
|
@@ -5848,6 +5900,9 @@ class RouterLinkWithHref {
|
|
|
5848
5900
|
this.router = router;
|
|
5849
5901
|
this.route = route;
|
|
5850
5902
|
this.locationStrategy = locationStrategy;
|
|
5903
|
+
this._preserveFragment = false;
|
|
5904
|
+
this._skipLocationChange = false;
|
|
5905
|
+
this._replaceUrl = false;
|
|
5851
5906
|
this.commands = null;
|
|
5852
5907
|
// the url displayed on the anchor element.
|
|
5853
5908
|
// @HostBinding('attr.href') is used rather than @HostBinding() because it removes the
|
|
@@ -5861,6 +5916,42 @@ class RouterLinkWithHref {
|
|
|
5861
5916
|
}
|
|
5862
5917
|
});
|
|
5863
5918
|
}
|
|
5919
|
+
/**
|
|
5920
|
+
* Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
|
|
5921
|
+
* `UrlCreationOptions`.
|
|
5922
|
+
* @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
|
|
5923
|
+
* @see {@link Router#createUrlTree Router#createUrlTree}
|
|
5924
|
+
*/
|
|
5925
|
+
set preserveFragment(preserveFragment) {
|
|
5926
|
+
this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
|
|
5927
|
+
}
|
|
5928
|
+
get preserveFragment() {
|
|
5929
|
+
return this._preserveFragment;
|
|
5930
|
+
}
|
|
5931
|
+
/**
|
|
5932
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5933
|
+
* `NavigationBehaviorOptions`.
|
|
5934
|
+
* @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
|
|
5935
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5936
|
+
*/
|
|
5937
|
+
set skipLocationChange(skipLocationChange) {
|
|
5938
|
+
this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
|
|
5939
|
+
}
|
|
5940
|
+
get skipLocationChange() {
|
|
5941
|
+
return this._skipLocationChange;
|
|
5942
|
+
}
|
|
5943
|
+
/**
|
|
5944
|
+
* Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
|
|
5945
|
+
* `NavigationBehaviorOptions`.
|
|
5946
|
+
* @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
|
|
5947
|
+
* @see {@link Router#navigateByUrl Router#navigateByUrl}
|
|
5948
|
+
*/
|
|
5949
|
+
set replaceUrl(replaceUrl) {
|
|
5950
|
+
this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
|
|
5951
|
+
}
|
|
5952
|
+
get replaceUrl() {
|
|
5953
|
+
return this._replaceUrl;
|
|
5954
|
+
}
|
|
5864
5955
|
/**
|
|
5865
5956
|
* Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
5866
5957
|
* - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
|
|
@@ -5894,8 +5985,8 @@ class RouterLinkWithHref {
|
|
|
5894
5985
|
return true;
|
|
5895
5986
|
}
|
|
5896
5987
|
const extras = {
|
|
5897
|
-
skipLocationChange:
|
|
5898
|
-
replaceUrl:
|
|
5988
|
+
skipLocationChange: this.skipLocationChange,
|
|
5989
|
+
replaceUrl: this.replaceUrl,
|
|
5899
5990
|
state: this.state
|
|
5900
5991
|
};
|
|
5901
5992
|
this.router.navigateByUrl(this.urlTree, extras);
|
|
@@ -5917,13 +6008,13 @@ class RouterLinkWithHref {
|
|
|
5917
6008
|
queryParams: this.queryParams,
|
|
5918
6009
|
fragment: this.fragment,
|
|
5919
6010
|
queryParamsHandling: this.queryParamsHandling,
|
|
5920
|
-
preserveFragment:
|
|
6011
|
+
preserveFragment: this.preserveFragment,
|
|
5921
6012
|
});
|
|
5922
6013
|
}
|
|
5923
6014
|
}
|
|
5924
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
5925
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
5926
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6015
|
+
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 });
|
|
6016
|
+
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 });
|
|
6017
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5927
6018
|
type: Directive,
|
|
5928
6019
|
args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
|
|
5929
6020
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5937,12 +6028,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
5937
6028
|
type: Input
|
|
5938
6029
|
}], queryParamsHandling: [{
|
|
5939
6030
|
type: Input
|
|
5940
|
-
}], preserveFragment: [{
|
|
5941
|
-
type: Input
|
|
5942
|
-
}], skipLocationChange: [{
|
|
5943
|
-
type: Input
|
|
5944
|
-
}], replaceUrl: [{
|
|
5945
|
-
type: Input
|
|
5946
6031
|
}], state: [{
|
|
5947
6032
|
type: Input
|
|
5948
6033
|
}], relativeTo: [{
|
|
@@ -5950,6 +6035,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
5950
6035
|
}], href: [{
|
|
5951
6036
|
type: HostBinding,
|
|
5952
6037
|
args: ['attr.href']
|
|
6038
|
+
}], preserveFragment: [{
|
|
6039
|
+
type: Input
|
|
6040
|
+
}], skipLocationChange: [{
|
|
6041
|
+
type: Input
|
|
6042
|
+
}], replaceUrl: [{
|
|
6043
|
+
type: Input
|
|
5953
6044
|
}], routerLink: [{
|
|
5954
6045
|
type: Input
|
|
5955
6046
|
}], onClick: [{
|
|
@@ -6150,9 +6241,9 @@ class RouterLinkActive {
|
|
|
6150
6241
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
6151
6242
|
}
|
|
6152
6243
|
}
|
|
6153
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6154
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.
|
|
6155
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6244
|
+
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 });
|
|
6245
|
+
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 });
|
|
6246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
6156
6247
|
type: Directive,
|
|
6157
6248
|
args: [{
|
|
6158
6249
|
selector: '[routerLinkActive]',
|
|
@@ -6219,9 +6310,9 @@ class PreloadAllModules {
|
|
|
6219
6310
|
return fn().pipe(catchError(() => of(null)));
|
|
6220
6311
|
}
|
|
6221
6312
|
}
|
|
6222
|
-
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6223
|
-
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6313
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6314
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
6315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
6225
6316
|
type: Injectable,
|
|
6226
6317
|
args: [{ providedIn: 'root' }]
|
|
6227
6318
|
}] });
|
|
@@ -6239,9 +6330,9 @@ class NoPreloading {
|
|
|
6239
6330
|
return of(null);
|
|
6240
6331
|
}
|
|
6241
6332
|
}
|
|
6242
|
-
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6243
|
-
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6333
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6334
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
6335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: NoPreloading, decorators: [{
|
|
6245
6336
|
type: Injectable,
|
|
6246
6337
|
args: [{ providedIn: 'root' }]
|
|
6247
6338
|
}] });
|
|
@@ -6337,10 +6428,11 @@ class RouterPreloader {
|
|
|
6337
6428
|
});
|
|
6338
6429
|
}
|
|
6339
6430
|
}
|
|
6340
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6341
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6342
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6343
|
-
type: Injectable
|
|
6431
|
+
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 });
|
|
6432
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
|
|
6433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
6434
|
+
type: Injectable,
|
|
6435
|
+
args: [{ providedIn: 'root' }]
|
|
6344
6436
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
6345
6437
|
|
|
6346
6438
|
const ROUTER_SCROLLER = new InjectionToken('');
|
|
@@ -6419,12 +6511,423 @@ class RouterScroller {
|
|
|
6419
6511
|
}
|
|
6420
6512
|
}
|
|
6421
6513
|
}
|
|
6422
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6423
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.
|
|
6424
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
6514
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6515
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterScroller });
|
|
6516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6425
6517
|
type: Injectable
|
|
6426
6518
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6427
6519
|
|
|
6520
|
+
/**
|
|
6521
|
+
* @license
|
|
6522
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6523
|
+
*
|
|
6524
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6525
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6526
|
+
*/
|
|
6527
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6528
|
+
/**
|
|
6529
|
+
* Sets up providers necessary to enable `Router` functionality for the application.
|
|
6530
|
+
* Allows to configure a set of routes as well as extra features that should be enabled.
|
|
6531
|
+
*
|
|
6532
|
+
* @usageNotes
|
|
6533
|
+
*
|
|
6534
|
+
* Basic example of how you can add a Router to your application:
|
|
6535
|
+
* ```
|
|
6536
|
+
* const appRoutes: Routes = [];
|
|
6537
|
+
* bootstrapApplication(AppComponent, {
|
|
6538
|
+
* providers: [provideRouter(appRoutes)]
|
|
6539
|
+
* });
|
|
6540
|
+
* ```
|
|
6541
|
+
*
|
|
6542
|
+
* You can also enable optional features in the Router by adding functions from the `RouterFeatures`
|
|
6543
|
+
* type:
|
|
6544
|
+
* ```
|
|
6545
|
+
* const appRoutes: Routes = [];
|
|
6546
|
+
* bootstrapApplication(AppComponent,
|
|
6547
|
+
* {
|
|
6548
|
+
* providers: [
|
|
6549
|
+
* provideRouter(appRoutes,
|
|
6550
|
+
* withDebugTracing(),
|
|
6551
|
+
* withRouterConfig({paramsInheritanceStrategy: 'always'}))
|
|
6552
|
+
* ]
|
|
6553
|
+
* }
|
|
6554
|
+
* );
|
|
6555
|
+
* ```
|
|
6556
|
+
*
|
|
6557
|
+
* @see `RouterFeatures`
|
|
6558
|
+
*
|
|
6559
|
+
* @publicApi
|
|
6560
|
+
* @developerPreview
|
|
6561
|
+
* @param routes A set of `Route`s to use for the application routing table.
|
|
6562
|
+
* @param features Optional features to configure additional router behaviors.
|
|
6563
|
+
* @returns A set of providers to setup a Router.
|
|
6564
|
+
*/
|
|
6565
|
+
function provideRouter(routes, ...features) {
|
|
6566
|
+
return [
|
|
6567
|
+
provideRoutes(routes), { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6568
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
|
|
6569
|
+
features.map(feature => feature.ɵproviders),
|
|
6570
|
+
// TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
|
|
6571
|
+
// how we want them to be configured. This API doesn't currently have a way to configure them
|
|
6572
|
+
// and we should decide what the _best_ way to do that is rather than just sticking with the
|
|
6573
|
+
// status quo of how it's done today.
|
|
6574
|
+
];
|
|
6575
|
+
}
|
|
6576
|
+
function rootRoute(router) {
|
|
6577
|
+
return router.routerState.root;
|
|
6578
|
+
}
|
|
6579
|
+
/**
|
|
6580
|
+
* Helper function to create an object that represents a Router feature.
|
|
6581
|
+
*/
|
|
6582
|
+
function routerFeature(kind, providers) {
|
|
6583
|
+
return { ɵkind: kind, ɵproviders: providers };
|
|
6584
|
+
}
|
|
6585
|
+
/**
|
|
6586
|
+
* Registers a [DI provider](guide/glossary#provider) for a set of routes.
|
|
6587
|
+
* @param routes The route configuration to provide.
|
|
6588
|
+
*
|
|
6589
|
+
* @usageNotes
|
|
6590
|
+
*
|
|
6591
|
+
* ```
|
|
6592
|
+
* @NgModule({
|
|
6593
|
+
* providers: [provideRoutes(ROUTES)]
|
|
6594
|
+
* })
|
|
6595
|
+
* class LazyLoadedChildModule {}
|
|
6596
|
+
* ```
|
|
6597
|
+
*
|
|
6598
|
+
* @publicApi
|
|
6599
|
+
*/
|
|
6600
|
+
function provideRoutes(routes) {
|
|
6601
|
+
return [
|
|
6602
|
+
{ provide: ROUTES, multi: true, useValue: routes },
|
|
6603
|
+
];
|
|
6604
|
+
}
|
|
6605
|
+
/**
|
|
6606
|
+
* Enables customizable scrolling behavior for router navigations.
|
|
6607
|
+
*
|
|
6608
|
+
* @usageNotes
|
|
6609
|
+
*
|
|
6610
|
+
* Basic example of how you can enable scrolling feature:
|
|
6611
|
+
* ```
|
|
6612
|
+
* const appRoutes: Routes = [];
|
|
6613
|
+
* bootstrapApplication(AppComponent,
|
|
6614
|
+
* {
|
|
6615
|
+
* providers: [
|
|
6616
|
+
* provideRouter(appRoutes, withInMemoryScrolling())
|
|
6617
|
+
* ]
|
|
6618
|
+
* }
|
|
6619
|
+
* );
|
|
6620
|
+
* ```
|
|
6621
|
+
*
|
|
6622
|
+
* @see `provideRouter`
|
|
6623
|
+
* @see `ViewportScroller`
|
|
6624
|
+
*
|
|
6625
|
+
* @publicApi
|
|
6626
|
+
* @developerPreview
|
|
6627
|
+
* @param options Set of configuration parameters to customize scrolling behavior, see
|
|
6628
|
+
* `InMemoryScrollingOptions` for additional information.
|
|
6629
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6630
|
+
*/
|
|
6631
|
+
function withInMemoryScrolling(options = {}) {
|
|
6632
|
+
const providers = [{
|
|
6633
|
+
provide: ROUTER_SCROLLER,
|
|
6634
|
+
useFactory: () => {
|
|
6635
|
+
const router = inject(Router);
|
|
6636
|
+
const viewportScroller = inject(ViewportScroller);
|
|
6637
|
+
return new RouterScroller(router, viewportScroller, options);
|
|
6638
|
+
},
|
|
6639
|
+
}];
|
|
6640
|
+
return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
|
|
6641
|
+
}
|
|
6642
|
+
function getBootstrapListener() {
|
|
6643
|
+
const injector = inject(Injector);
|
|
6644
|
+
return (bootstrappedComponentRef) => {
|
|
6645
|
+
var _a, _b;
|
|
6646
|
+
const ref = injector.get(ApplicationRef);
|
|
6647
|
+
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6648
|
+
return;
|
|
6649
|
+
}
|
|
6650
|
+
const router = injector.get(Router);
|
|
6651
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6652
|
+
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6653
|
+
router.initialNavigation();
|
|
6654
|
+
}
|
|
6655
|
+
(_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
|
|
6656
|
+
(_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
|
|
6657
|
+
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6658
|
+
bootstrapDone.next();
|
|
6659
|
+
bootstrapDone.complete();
|
|
6660
|
+
};
|
|
6661
|
+
}
|
|
6662
|
+
/**
|
|
6663
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6664
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6665
|
+
* to the activation phase.
|
|
6666
|
+
*/
|
|
6667
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE$1 ? 'bootstrap done indicator' : '', {
|
|
6668
|
+
factory: () => {
|
|
6669
|
+
return new Subject();
|
|
6670
|
+
}
|
|
6671
|
+
});
|
|
6672
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE$1 ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6673
|
+
/**
|
|
6674
|
+
* Configures initial navigation to start before the root component is created.
|
|
6675
|
+
*
|
|
6676
|
+
* The bootstrap is blocked until the initial navigation is complete. This value is required for
|
|
6677
|
+
* [server-side rendering](guide/universal) to work.
|
|
6678
|
+
*
|
|
6679
|
+
* @usageNotes
|
|
6680
|
+
*
|
|
6681
|
+
* Basic example of how you can enable this navigation behavior:
|
|
6682
|
+
* ```
|
|
6683
|
+
* const appRoutes: Routes = [];
|
|
6684
|
+
* bootstrapApplication(AppComponent,
|
|
6685
|
+
* {
|
|
6686
|
+
* providers: [
|
|
6687
|
+
* provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
|
|
6688
|
+
* ]
|
|
6689
|
+
* }
|
|
6690
|
+
* );
|
|
6691
|
+
* ```
|
|
6692
|
+
*
|
|
6693
|
+
* @see `provideRouter`
|
|
6694
|
+
*
|
|
6695
|
+
* @publicApi
|
|
6696
|
+
* @developerPreview
|
|
6697
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6698
|
+
*/
|
|
6699
|
+
function withEnabledBlockingInitialNavigation() {
|
|
6700
|
+
const providers = [
|
|
6701
|
+
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6702
|
+
{
|
|
6703
|
+
provide: APP_INITIALIZER,
|
|
6704
|
+
multi: true,
|
|
6705
|
+
deps: [Injector],
|
|
6706
|
+
useFactory: (injector) => {
|
|
6707
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());
|
|
6708
|
+
let initNavigation = false;
|
|
6709
|
+
/**
|
|
6710
|
+
* Performs the given action once the router finishes its next/current navigation.
|
|
6711
|
+
*
|
|
6712
|
+
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6713
|
+
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6714
|
+
*/
|
|
6715
|
+
function afterNextNavigation(action) {
|
|
6716
|
+
const router = injector.get(Router);
|
|
6717
|
+
router.events
|
|
6718
|
+
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6719
|
+
e instanceof NavigationError), map(e => {
|
|
6720
|
+
if (e instanceof NavigationEnd) {
|
|
6721
|
+
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6722
|
+
return true;
|
|
6723
|
+
}
|
|
6724
|
+
const redirecting = e instanceof NavigationCancel ?
|
|
6725
|
+
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6726
|
+
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6727
|
+
false;
|
|
6728
|
+
return redirecting ? null : false;
|
|
6729
|
+
}), filter((result) => result !== null), take(1))
|
|
6730
|
+
.subscribe(() => {
|
|
6731
|
+
action();
|
|
6732
|
+
});
|
|
6733
|
+
}
|
|
6734
|
+
return () => {
|
|
6735
|
+
return locationInitialized.then(() => {
|
|
6736
|
+
return new Promise(resolve => {
|
|
6737
|
+
const router = injector.get(Router);
|
|
6738
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6739
|
+
afterNextNavigation(() => {
|
|
6740
|
+
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6741
|
+
// without a redirect.
|
|
6742
|
+
resolve(true);
|
|
6743
|
+
initNavigation = true;
|
|
6744
|
+
});
|
|
6745
|
+
router.afterPreactivation = () => {
|
|
6746
|
+
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6747
|
+
// assume activation will complete successfully (even though this is not
|
|
6748
|
+
// guaranteed).
|
|
6749
|
+
resolve(true);
|
|
6750
|
+
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6751
|
+
if (!initNavigation) {
|
|
6752
|
+
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6753
|
+
// subsequent navigations should not be delayed
|
|
6754
|
+
}
|
|
6755
|
+
else {
|
|
6756
|
+
return of(void 0);
|
|
6757
|
+
}
|
|
6758
|
+
};
|
|
6759
|
+
router.initialNavigation();
|
|
6760
|
+
});
|
|
6761
|
+
});
|
|
6762
|
+
};
|
|
6763
|
+
}
|
|
6764
|
+
},
|
|
6765
|
+
];
|
|
6766
|
+
return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);
|
|
6767
|
+
}
|
|
6768
|
+
/**
|
|
6769
|
+
* Disables initial navigation.
|
|
6770
|
+
*
|
|
6771
|
+
* Use if there is a reason to have more control over when the router starts its initial navigation
|
|
6772
|
+
* due to some complex initialization logic.
|
|
6773
|
+
*
|
|
6774
|
+
* @usageNotes
|
|
6775
|
+
*
|
|
6776
|
+
* Basic example of how you can disable initial navigation:
|
|
6777
|
+
* ```
|
|
6778
|
+
* const appRoutes: Routes = [];
|
|
6779
|
+
* bootstrapApplication(AppComponent,
|
|
6780
|
+
* {
|
|
6781
|
+
* providers: [
|
|
6782
|
+
* provideRouter(appRoutes, withDisabledInitialNavigation())
|
|
6783
|
+
* ]
|
|
6784
|
+
* }
|
|
6785
|
+
* );
|
|
6786
|
+
* ```
|
|
6787
|
+
*
|
|
6788
|
+
* @see `provideRouter`
|
|
6789
|
+
*
|
|
6790
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6791
|
+
*
|
|
6792
|
+
* @publicApi
|
|
6793
|
+
* @developerPreview
|
|
6794
|
+
*/
|
|
6795
|
+
function withDisabledInitialNavigation() {
|
|
6796
|
+
const providers = [
|
|
6797
|
+
{
|
|
6798
|
+
provide: APP_INITIALIZER,
|
|
6799
|
+
multi: true,
|
|
6800
|
+
useFactory: () => {
|
|
6801
|
+
const router = inject(Router);
|
|
6802
|
+
return () => {
|
|
6803
|
+
router.setUpLocationChangeListener();
|
|
6804
|
+
};
|
|
6805
|
+
}
|
|
6806
|
+
},
|
|
6807
|
+
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6808
|
+
];
|
|
6809
|
+
return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);
|
|
6810
|
+
}
|
|
6811
|
+
/**
|
|
6812
|
+
* Enables logging of all internal navigation events to the console.
|
|
6813
|
+
* Extra logging might be useful for debugging purposes to inspect Router event sequence.
|
|
6814
|
+
*
|
|
6815
|
+
* @usageNotes
|
|
6816
|
+
*
|
|
6817
|
+
* Basic example of how you can enable debug tracing:
|
|
6818
|
+
* ```
|
|
6819
|
+
* const appRoutes: Routes = [];
|
|
6820
|
+
* bootstrapApplication(AppComponent,
|
|
6821
|
+
* {
|
|
6822
|
+
* providers: [
|
|
6823
|
+
* provideRouter(appRoutes, withDebugTracing())
|
|
6824
|
+
* ]
|
|
6825
|
+
* }
|
|
6826
|
+
* );
|
|
6827
|
+
* ```
|
|
6828
|
+
*
|
|
6829
|
+
* @see `provideRouter`
|
|
6830
|
+
*
|
|
6831
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6832
|
+
*
|
|
6833
|
+
* @publicApi
|
|
6834
|
+
* @developerPreview
|
|
6835
|
+
*/
|
|
6836
|
+
function withDebugTracing() {
|
|
6837
|
+
let providers = [];
|
|
6838
|
+
if (NG_DEV_MODE$1) {
|
|
6839
|
+
providers = [{
|
|
6840
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6841
|
+
multi: true,
|
|
6842
|
+
useFactory: () => {
|
|
6843
|
+
const router = inject(Router);
|
|
6844
|
+
return () => router.events.subscribe((e) => {
|
|
6845
|
+
var _a, _b;
|
|
6846
|
+
// tslint:disable:no-console
|
|
6847
|
+
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6848
|
+
console.log(stringifyEvent(e));
|
|
6849
|
+
console.log(e);
|
|
6850
|
+
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6851
|
+
// tslint:enable:no-console
|
|
6852
|
+
});
|
|
6853
|
+
}
|
|
6854
|
+
}];
|
|
6855
|
+
}
|
|
6856
|
+
else {
|
|
6857
|
+
providers = [];
|
|
6858
|
+
}
|
|
6859
|
+
return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
|
|
6860
|
+
}
|
|
6861
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE$1 ? 'router preloader' : '');
|
|
6862
|
+
/**
|
|
6863
|
+
* Allows to configure a preloading strategy to use. The strategy is configured by providing a
|
|
6864
|
+
* reference to a class that implements a `PreloadingStrategy`.
|
|
6865
|
+
*
|
|
6866
|
+
* @usageNotes
|
|
6867
|
+
*
|
|
6868
|
+
* Basic example of how you can configure preloading:
|
|
6869
|
+
* ```
|
|
6870
|
+
* const appRoutes: Routes = [];
|
|
6871
|
+
* bootstrapApplication(AppComponent,
|
|
6872
|
+
* {
|
|
6873
|
+
* providers: [
|
|
6874
|
+
* provideRouter(appRoutes, withPreloading(PreloadAllModules))
|
|
6875
|
+
* ]
|
|
6876
|
+
* }
|
|
6877
|
+
* );
|
|
6878
|
+
* ```
|
|
6879
|
+
*
|
|
6880
|
+
* @see `provideRouter`
|
|
6881
|
+
*
|
|
6882
|
+
* @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
|
|
6883
|
+
* should be used.
|
|
6884
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6885
|
+
*
|
|
6886
|
+
* @publicApi
|
|
6887
|
+
* @developerPreview
|
|
6888
|
+
*/
|
|
6889
|
+
function withPreloading(preloadingStrategy) {
|
|
6890
|
+
const providers = [
|
|
6891
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6892
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6893
|
+
];
|
|
6894
|
+
return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);
|
|
6895
|
+
}
|
|
6896
|
+
/**
|
|
6897
|
+
* Allows to provide extra parameters to configure Router.
|
|
6898
|
+
*
|
|
6899
|
+
* @usageNotes
|
|
6900
|
+
*
|
|
6901
|
+
* Basic example of how you can provide extra configuration options:
|
|
6902
|
+
* ```
|
|
6903
|
+
* const appRoutes: Routes = [];
|
|
6904
|
+
* bootstrapApplication(AppComponent,
|
|
6905
|
+
* {
|
|
6906
|
+
* providers: [
|
|
6907
|
+
* provideRouter(appRoutes, withRouterConfig({
|
|
6908
|
+
* onSameUrlNavigation: 'reload'
|
|
6909
|
+
* }))
|
|
6910
|
+
* ]
|
|
6911
|
+
* }
|
|
6912
|
+
* );
|
|
6913
|
+
* ```
|
|
6914
|
+
*
|
|
6915
|
+
* @see `provideRouter`
|
|
6916
|
+
*
|
|
6917
|
+
* @param options A set of parameters to configure Router, see `RouterConfigOptions` for
|
|
6918
|
+
* additional information.
|
|
6919
|
+
* @returns A set of providers for use with `provideRouter`.
|
|
6920
|
+
*
|
|
6921
|
+
* @publicApi
|
|
6922
|
+
* @developerPreview
|
|
6923
|
+
*/
|
|
6924
|
+
function withRouterConfig(options) {
|
|
6925
|
+
const providers = [
|
|
6926
|
+
{ provide: ROUTER_CONFIGURATION, useValue: options },
|
|
6927
|
+
];
|
|
6928
|
+
return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);
|
|
6929
|
+
}
|
|
6930
|
+
|
|
6428
6931
|
/**
|
|
6429
6932
|
* @license
|
|
6430
6933
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6441,7 +6944,6 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6441
6944
|
* @docsNotRequired
|
|
6442
6945
|
*/
|
|
6443
6946
|
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6444
|
-
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6445
6947
|
// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
|
|
6446
6948
|
// here to avoid a breaking change whereby the provider order matters based on where the
|
|
6447
6949
|
// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
|
|
@@ -6454,9 +6956,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6454
6956
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6455
6957
|
RouterConfigLoader,
|
|
6456
6958
|
];
|
|
6457
|
-
function rootRoute(router) {
|
|
6458
|
-
return router.routerState.root;
|
|
6459
|
-
}
|
|
6460
6959
|
function routerNgProbeToken() {
|
|
6461
6960
|
return new NgProbeToken('Router', Router);
|
|
6462
6961
|
}
|
|
@@ -6506,7 +7005,7 @@ class RouterModule {
|
|
|
6506
7005
|
ngModule: RouterModule,
|
|
6507
7006
|
providers: [
|
|
6508
7007
|
ROUTER_PROVIDERS,
|
|
6509
|
-
NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ?
|
|
7008
|
+
NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ? withDebugTracing().ɵproviders : []) : [],
|
|
6510
7009
|
provideRoutes(routes),
|
|
6511
7010
|
{
|
|
6512
7011
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6516,7 +7015,7 @@ class RouterModule {
|
|
|
6516
7015
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6517
7016
|
(config === null || config === void 0 ? void 0 : config.useHash) ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6518
7017
|
provideRouterScroller(),
|
|
6519
|
-
(config === null || config === void 0 ? void 0 : config.preloadingStrategy) ?
|
|
7018
|
+
(config === null || config === void 0 ? void 0 : config.preloadingStrategy) ? withPreloading(config.preloadingStrategy).ɵproviders : [],
|
|
6520
7019
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6521
7020
|
(config === null || config === void 0 ? void 0 : config.initialNavigation) ? provideInitialNavigation(config) : [],
|
|
6522
7021
|
provideRouterInitializer(),
|
|
@@ -6543,10 +7042,10 @@ class RouterModule {
|
|
|
6543
7042
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6544
7043
|
}
|
|
6545
7044
|
}
|
|
6546
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.
|
|
6547
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.
|
|
6548
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.
|
|
6549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.
|
|
7045
|
+
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 });
|
|
7046
|
+
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] });
|
|
7047
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
|
|
7048
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: RouterModule, decorators: [{
|
|
6550
7049
|
type: NgModule,
|
|
6551
7050
|
args: [{
|
|
6552
7051
|
imports: ROUTER_DIRECTIVES,
|
|
@@ -6560,6 +7059,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1",
|
|
|
6560
7059
|
args: [ROUTER_FORROOT_GUARD]
|
|
6561
7060
|
}] }];
|
|
6562
7061
|
} });
|
|
7062
|
+
/**
|
|
7063
|
+
* For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`
|
|
7064
|
+
* because it reads from the `ExtraOptions` which should not be used in the standalone world.
|
|
7065
|
+
*/
|
|
6563
7066
|
function provideRouterScroller() {
|
|
6564
7067
|
return {
|
|
6565
7068
|
provide: ROUTER_SCROLLER,
|
|
@@ -6574,59 +7077,33 @@ function provideRouterScroller() {
|
|
|
6574
7077
|
},
|
|
6575
7078
|
};
|
|
6576
7079
|
}
|
|
7080
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should
|
|
7081
|
+
// provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.
|
|
6577
7082
|
function provideHashLocationStrategy() {
|
|
6578
7083
|
return { provide: LocationStrategy, useClass: HashLocationStrategy };
|
|
6579
7084
|
}
|
|
7085
|
+
// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not
|
|
7086
|
+
// need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.
|
|
6580
7087
|
function providePathLocationStrategy() {
|
|
6581
7088
|
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6582
7089
|
}
|
|
6583
7090
|
function provideForRootGuard(router) {
|
|
6584
7091
|
if (NG_DEV_MODE && router) {
|
|
6585
|
-
throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `
|
|
7092
|
+
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.` +
|
|
7093
|
+
` Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6586
7094
|
}
|
|
6587
7095
|
return 'guarded';
|
|
6588
7096
|
}
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
*
|
|
6593
|
-
* @usageNotes
|
|
6594
|
-
*
|
|
6595
|
-
* ```
|
|
6596
|
-
* @NgModule({
|
|
6597
|
-
* imports: [RouterModule.forChild(ROUTES)],
|
|
6598
|
-
* providers: [provideRoutes(EXTRA_ROUTES)]
|
|
6599
|
-
* })
|
|
6600
|
-
* class MyNgModule {}
|
|
6601
|
-
* ```
|
|
6602
|
-
*
|
|
6603
|
-
* @publicApi
|
|
6604
|
-
*/
|
|
6605
|
-
function provideRoutes(routes) {
|
|
7097
|
+
// Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`
|
|
7098
|
+
// users call `withXInitialNavigation` directly.
|
|
7099
|
+
function provideInitialNavigation(config) {
|
|
6606
7100
|
return [
|
|
6607
|
-
|
|
7101
|
+
config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [],
|
|
7102
|
+
config.initialNavigation === 'enabledBlocking' ?
|
|
7103
|
+
withEnabledBlockingInitialNavigation().ɵproviders :
|
|
7104
|
+
[],
|
|
6608
7105
|
];
|
|
6609
7106
|
}
|
|
6610
|
-
function getBootstrapListener() {
|
|
6611
|
-
const injector = inject(Injector);
|
|
6612
|
-
return (bootstrappedComponentRef) => {
|
|
6613
|
-
var _a, _b;
|
|
6614
|
-
const ref = injector.get(ApplicationRef);
|
|
6615
|
-
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6616
|
-
return;
|
|
6617
|
-
}
|
|
6618
|
-
const router = injector.get(Router);
|
|
6619
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6620
|
-
if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
|
|
6621
|
-
router.initialNavigation();
|
|
6622
|
-
}
|
|
6623
|
-
(_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
|
|
6624
|
-
(_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
|
|
6625
|
-
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6626
|
-
bootstrapDone.next();
|
|
6627
|
-
bootstrapDone.complete();
|
|
6628
|
-
};
|
|
6629
|
-
}
|
|
6630
7107
|
// TODO(atscott): This should not be in the public API
|
|
6631
7108
|
/**
|
|
6632
7109
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
@@ -6635,12 +7112,6 @@ function getBootstrapListener() {
|
|
|
6635
7112
|
* @publicApi
|
|
6636
7113
|
*/
|
|
6637
7114
|
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6638
|
-
function provideInitialNavigation(config) {
|
|
6639
|
-
return [
|
|
6640
|
-
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6641
|
-
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6642
|
-
];
|
|
6643
|
-
}
|
|
6644
7115
|
function provideRouterInitializer() {
|
|
6645
7116
|
return [
|
|
6646
7117
|
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
@@ -6649,130 +7120,6 @@ function provideRouterInitializer() {
|
|
|
6649
7120
|
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6650
7121
|
];
|
|
6651
7122
|
}
|
|
6652
|
-
/**
|
|
6653
|
-
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6654
|
-
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6655
|
-
* to the activation phase.
|
|
6656
|
-
*/
|
|
6657
|
-
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6658
|
-
factory: () => {
|
|
6659
|
-
return new Subject();
|
|
6660
|
-
}
|
|
6661
|
-
});
|
|
6662
|
-
function provideEnabledBlockingInitialNavigation() {
|
|
6663
|
-
return [
|
|
6664
|
-
{ provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
|
|
6665
|
-
{
|
|
6666
|
-
provide: APP_INITIALIZER,
|
|
6667
|
-
multi: true,
|
|
6668
|
-
deps: [Injector],
|
|
6669
|
-
useFactory: (injector) => {
|
|
6670
|
-
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6671
|
-
let initNavigation = false;
|
|
6672
|
-
/**
|
|
6673
|
-
* Performs the given action once the router finishes its next/current navigation.
|
|
6674
|
-
*
|
|
6675
|
-
* If the navigation is canceled or errors without a redirect, the navigation is considered
|
|
6676
|
-
* complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
|
|
6677
|
-
*/
|
|
6678
|
-
function afterNextNavigation(action) {
|
|
6679
|
-
const router = injector.get(Router);
|
|
6680
|
-
router.events
|
|
6681
|
-
.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
|
|
6682
|
-
e instanceof NavigationError), map(e => {
|
|
6683
|
-
if (e instanceof NavigationEnd) {
|
|
6684
|
-
// Navigation assumed to succeed if we get `ActivationStart`
|
|
6685
|
-
return true;
|
|
6686
|
-
}
|
|
6687
|
-
const redirecting = e instanceof NavigationCancel ?
|
|
6688
|
-
(e.code === 0 /* NavigationCancellationCode.Redirect */ ||
|
|
6689
|
-
e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
|
|
6690
|
-
false;
|
|
6691
|
-
return redirecting ? null : false;
|
|
6692
|
-
}), filter((result) => result !== null), take(1))
|
|
6693
|
-
.subscribe(() => {
|
|
6694
|
-
action();
|
|
6695
|
-
});
|
|
6696
|
-
}
|
|
6697
|
-
return () => {
|
|
6698
|
-
return locationInitialized.then(() => {
|
|
6699
|
-
return new Promise(resolve => {
|
|
6700
|
-
const router = injector.get(Router);
|
|
6701
|
-
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6702
|
-
afterNextNavigation(() => {
|
|
6703
|
-
// Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
|
|
6704
|
-
// without a redirect.
|
|
6705
|
-
resolve(true);
|
|
6706
|
-
initNavigation = true;
|
|
6707
|
-
});
|
|
6708
|
-
router.afterPreactivation = () => {
|
|
6709
|
-
// Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
|
|
6710
|
-
// assume activation will complete successfully (even though this is not
|
|
6711
|
-
// guaranteed).
|
|
6712
|
-
resolve(true);
|
|
6713
|
-
// only the initial navigation should be delayed until bootstrapping is done.
|
|
6714
|
-
if (!initNavigation) {
|
|
6715
|
-
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
|
|
6716
|
-
// subsequent navigations should not be delayed
|
|
6717
|
-
}
|
|
6718
|
-
else {
|
|
6719
|
-
return of(void 0);
|
|
6720
|
-
}
|
|
6721
|
-
};
|
|
6722
|
-
router.initialNavigation();
|
|
6723
|
-
});
|
|
6724
|
-
});
|
|
6725
|
-
};
|
|
6726
|
-
}
|
|
6727
|
-
},
|
|
6728
|
-
];
|
|
6729
|
-
}
|
|
6730
|
-
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
|
|
6731
|
-
function provideDisabledInitialNavigation() {
|
|
6732
|
-
return [
|
|
6733
|
-
{
|
|
6734
|
-
provide: APP_INITIALIZER,
|
|
6735
|
-
multi: true,
|
|
6736
|
-
useFactory: () => {
|
|
6737
|
-
const router = inject(Router);
|
|
6738
|
-
return () => {
|
|
6739
|
-
router.setUpLocationChangeListener();
|
|
6740
|
-
};
|
|
6741
|
-
}
|
|
6742
|
-
},
|
|
6743
|
-
{ provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
|
|
6744
|
-
];
|
|
6745
|
-
}
|
|
6746
|
-
function provideTracing() {
|
|
6747
|
-
if (NG_DEV_MODE) {
|
|
6748
|
-
return [{
|
|
6749
|
-
provide: ENVIRONMENT_INITIALIZER,
|
|
6750
|
-
multi: true,
|
|
6751
|
-
useFactory: () => {
|
|
6752
|
-
const router = inject(Router);
|
|
6753
|
-
return () => router.events.subscribe((e) => {
|
|
6754
|
-
var _a, _b;
|
|
6755
|
-
// tslint:disable:no-console
|
|
6756
|
-
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6757
|
-
console.log(stringifyEvent(e));
|
|
6758
|
-
console.log(e);
|
|
6759
|
-
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6760
|
-
// tslint:enable:no-console
|
|
6761
|
-
});
|
|
6762
|
-
}
|
|
6763
|
-
}];
|
|
6764
|
-
}
|
|
6765
|
-
else {
|
|
6766
|
-
return [];
|
|
6767
|
-
}
|
|
6768
|
-
}
|
|
6769
|
-
function providePreloading(preloadingStrategy) {
|
|
6770
|
-
return [
|
|
6771
|
-
RouterPreloader,
|
|
6772
|
-
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6773
|
-
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6774
|
-
];
|
|
6775
|
-
}
|
|
6776
7123
|
|
|
6777
7124
|
/**
|
|
6778
7125
|
* @license
|
|
@@ -6784,7 +7131,7 @@ function providePreloading(preloadingStrategy) {
|
|
|
6784
7131
|
/**
|
|
6785
7132
|
* @publicApi
|
|
6786
7133
|
*/
|
|
6787
|
-
const VERSION = new Version('14.2.
|
|
7134
|
+
const VERSION = new Version('14.2.1');
|
|
6788
7135
|
|
|
6789
7136
|
/**
|
|
6790
7137
|
* @license
|
|
@@ -6823,5 +7170,5 @@ const VERSION = new Version('14.2.0-next.1');
|
|
|
6823
7170
|
* Generated bundle index. Do not edit.
|
|
6824
7171
|
*/
|
|
6825
7172
|
|
|
6826
|
-
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,
|
|
7173
|
+
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 };
|
|
6827
7174
|
//# sourceMappingURL=router.mjs.map
|