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