@angular/router 14.0.3 → 14.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/directives/router_link.mjs +6 -6
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +8 -5
- package/esm2020/src/page_title_strategy.mjs +3 -3
- package/esm2020/src/private_export.mjs +2 -2
- package/esm2020/src/router.mjs +3 -3
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +151 -136
- package/esm2020/src/router_preloader.mjs +16 -4
- package/esm2020/src/router_scroller.mjs +6 -5
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +8 -8
- package/fesm2015/router.mjs +208 -175
- 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 +205 -174
- 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 +7 -1
- package/package.json +4 -4
- package/testing/index.d.ts +2 -2
- package/upgrade/index.d.ts +1 -1
package/fesm2015/router.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.
|
|
2
|
+
* @license Angular v14.0.4
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf,
|
|
8
|
+
import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
|
|
9
9
|
import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
10
10
|
import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, mapTo, finalize, refCount, defaultIfEmpty, mergeAll } from 'rxjs/operators';
|
|
11
11
|
import * as i3 from '@angular/common';
|
|
12
|
-
import { Location, LocationStrategy,
|
|
12
|
+
import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
|
|
13
13
|
import * as i1 from '@angular/platform-browser';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -2234,7 +2234,11 @@ class RouterOutlet {
|
|
|
2234
2234
|
}
|
|
2235
2235
|
/** @nodoc */
|
|
2236
2236
|
ngOnDestroy() {
|
|
2237
|
-
|
|
2237
|
+
var _a;
|
|
2238
|
+
// Ensure that the registered outlet is this one before removing it on the context.
|
|
2239
|
+
if (((_a = this.parentContexts.getContext(this.name)) === null || _a === void 0 ? void 0 : _a.outlet) === this) {
|
|
2240
|
+
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
2241
|
+
}
|
|
2238
2242
|
}
|
|
2239
2243
|
/** @nodoc */
|
|
2240
2244
|
ngOnInit() {
|
|
@@ -2332,9 +2336,9 @@ class RouterOutlet {
|
|
|
2332
2336
|
this.activateEvents.emit(this.activated.instance);
|
|
2333
2337
|
}
|
|
2334
2338
|
}
|
|
2335
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2336
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
2337
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2339
|
+
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2340
|
+
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
|
|
2341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2338
2342
|
type: Directive,
|
|
2339
2343
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2340
2344
|
}], ctorParameters: function () {
|
|
@@ -2393,9 +2397,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2393
2397
|
*/
|
|
2394
2398
|
class ɵEmptyOutletComponent {
|
|
2395
2399
|
}
|
|
2396
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2397
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.
|
|
2398
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2400
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2401
|
+
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
2402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2399
2403
|
type: Component,
|
|
2400
2404
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2401
2405
|
}] });
|
|
@@ -3661,7 +3665,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3661
3665
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3662
3666
|
* found in the LICENSE file at https://angular.io/license
|
|
3663
3667
|
*/
|
|
3664
|
-
const NG_DEV_MODE$
|
|
3668
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3665
3669
|
class NoMatch {
|
|
3666
3670
|
}
|
|
3667
3671
|
function newObservableError(e) {
|
|
@@ -3783,7 +3787,7 @@ class Recognizer {
|
|
|
3783
3787
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3784
3788
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3785
3789
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3786
|
-
(NG_DEV_MODE$
|
|
3790
|
+
(NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3787
3791
|
pathIndexShift));
|
|
3788
3792
|
}
|
|
3789
3793
|
else {
|
|
@@ -3794,7 +3798,7 @@ class Recognizer {
|
|
|
3794
3798
|
consumedSegments = result.consumedSegments;
|
|
3795
3799
|
remainingSegments = result.remainingSegments;
|
|
3796
3800
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
3797
|
-
snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_d = (_c = route.component) !== null && _c !== void 0 ? _c : route._loadedComponent) !== null && _d !== void 0 ? _d : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$
|
|
3801
|
+
snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_d = (_c = route.component) !== null && _c !== void 0 ? _c : route._loadedComponent) !== null && _d !== void 0 ? _d : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3798
3802
|
pathIndexShift));
|
|
3799
3803
|
}
|
|
3800
3804
|
const childConfig = getChildConfig(route);
|
|
@@ -4100,7 +4104,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4100
4104
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4101
4105
|
* found in the LICENSE file at https://angular.io/license
|
|
4102
4106
|
*/
|
|
4103
|
-
const NG_DEV_MODE$
|
|
4107
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4104
4108
|
/**
|
|
4105
4109
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4106
4110
|
*
|
|
@@ -4135,7 +4139,7 @@ class RouterConfigLoader {
|
|
|
4135
4139
|
if (this.onLoadEndListener) {
|
|
4136
4140
|
this.onLoadEndListener(route);
|
|
4137
4141
|
}
|
|
4138
|
-
NG_DEV_MODE$
|
|
4142
|
+
NG_DEV_MODE$2 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
|
|
4139
4143
|
route._loadedComponent = component;
|
|
4140
4144
|
}), finalize(() => {
|
|
4141
4145
|
this.componentLoaders.delete(route);
|
|
@@ -4178,7 +4182,7 @@ class RouterConfigLoader {
|
|
|
4178
4182
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4179
4183
|
}
|
|
4180
4184
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4181
|
-
NG_DEV_MODE$
|
|
4185
|
+
NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4182
4186
|
return { routes, injector };
|
|
4183
4187
|
}), finalize(() => {
|
|
4184
4188
|
this.childrenLoaders.delete(route);
|
|
@@ -4200,9 +4204,9 @@ class RouterConfigLoader {
|
|
|
4200
4204
|
}));
|
|
4201
4205
|
}
|
|
4202
4206
|
}
|
|
4203
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
4204
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
4205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
4207
|
+
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4208
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader });
|
|
4209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4206
4210
|
type: Injectable
|
|
4207
4211
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4208
4212
|
|
|
@@ -4237,7 +4241,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4237
4241
|
}
|
|
4238
4242
|
}
|
|
4239
4243
|
|
|
4240
|
-
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4244
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4241
4245
|
function defaultErrorHandler(error) {
|
|
4242
4246
|
throw error;
|
|
4243
4247
|
}
|
|
@@ -4808,7 +4812,7 @@ class Router {
|
|
|
4808
4812
|
* ```
|
|
4809
4813
|
*/
|
|
4810
4814
|
resetConfig(config) {
|
|
4811
|
-
NG_DEV_MODE && validateConfig(config);
|
|
4815
|
+
NG_DEV_MODE$1 && validateConfig(config);
|
|
4812
4816
|
this.config = config.map(standardizeConfig);
|
|
4813
4817
|
this.navigated = false;
|
|
4814
4818
|
this.lastSuccessfulId = -1;
|
|
@@ -5166,9 +5170,9 @@ class Router {
|
|
|
5166
5170
|
return { navigationId };
|
|
5167
5171
|
}
|
|
5168
5172
|
}
|
|
5169
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5170
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5173
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5174
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router });
|
|
5175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, decorators: [{
|
|
5172
5176
|
type: Injectable
|
|
5173
5177
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5174
5178
|
function validateCommands(commands) {
|
|
@@ -5360,9 +5364,9 @@ class RouterLink {
|
|
|
5360
5364
|
});
|
|
5361
5365
|
}
|
|
5362
5366
|
}
|
|
5363
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5364
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5365
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5367
|
+
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5368
|
+
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
5369
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLink, decorators: [{
|
|
5366
5370
|
type: Directive,
|
|
5367
5371
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5368
5372
|
}], ctorParameters: function () {
|
|
@@ -5481,9 +5485,9 @@ class RouterLinkWithHref {
|
|
|
5481
5485
|
});
|
|
5482
5486
|
}
|
|
5483
5487
|
}
|
|
5484
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5485
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5486
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5488
|
+
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5489
|
+
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
|
|
5490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5487
5491
|
type: Directive,
|
|
5488
5492
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5489
5493
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5710,9 +5714,9 @@ class RouterLinkActive {
|
|
|
5710
5714
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5711
5715
|
}
|
|
5712
5716
|
}
|
|
5713
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5714
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5715
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5717
|
+
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5718
|
+
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
|
|
5719
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkActive, decorators: [{
|
|
5716
5720
|
type: Directive,
|
|
5717
5721
|
args: [{
|
|
5718
5722
|
selector: '[routerLinkActive]',
|
|
@@ -5818,9 +5822,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
5818
5822
|
}
|
|
5819
5823
|
}
|
|
5820
5824
|
}
|
|
5821
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5822
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5823
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5825
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5826
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
5827
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
5824
5828
|
type: Injectable,
|
|
5825
5829
|
args: [{ providedIn: 'root' }]
|
|
5826
5830
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -5857,6 +5861,12 @@ class PreloadAllModules {
|
|
|
5857
5861
|
return fn().pipe(catchError(() => of(null)));
|
|
5858
5862
|
}
|
|
5859
5863
|
}
|
|
5864
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5865
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
5866
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
5867
|
+
type: Injectable,
|
|
5868
|
+
args: [{ providedIn: 'root' }]
|
|
5869
|
+
}] });
|
|
5860
5870
|
/**
|
|
5861
5871
|
* @description
|
|
5862
5872
|
*
|
|
@@ -5871,6 +5881,12 @@ class NoPreloading {
|
|
|
5871
5881
|
return of(null);
|
|
5872
5882
|
}
|
|
5873
5883
|
}
|
|
5884
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5885
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
5886
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, decorators: [{
|
|
5887
|
+
type: Injectable,
|
|
5888
|
+
args: [{ providedIn: 'root' }]
|
|
5889
|
+
}] });
|
|
5874
5890
|
/**
|
|
5875
5891
|
* The preloader optimistically loads all router configurations to
|
|
5876
5892
|
* make navigations into lazily-loaded sections of the application faster.
|
|
@@ -5955,12 +5971,13 @@ class RouterPreloader {
|
|
|
5955
5971
|
});
|
|
5956
5972
|
}
|
|
5957
5973
|
}
|
|
5958
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5959
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5960
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5974
|
+
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5975
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader });
|
|
5976
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
5961
5977
|
type: Injectable
|
|
5962
5978
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
5963
5979
|
|
|
5980
|
+
const ROUTER_SCROLLER = new InjectionToken('');
|
|
5964
5981
|
class RouterScroller {
|
|
5965
5982
|
constructor(router,
|
|
5966
5983
|
/** @docsNotRequired */ viewportScroller, options = {}) {
|
|
@@ -6036,9 +6053,9 @@ class RouterScroller {
|
|
|
6036
6053
|
}
|
|
6037
6054
|
}
|
|
6038
6055
|
}
|
|
6039
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
6040
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
6041
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
6056
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6057
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller });
|
|
6058
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6042
6059
|
type: Injectable
|
|
6043
6060
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6044
6061
|
|
|
@@ -6049,6 +6066,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
6049
6066
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6050
6067
|
* found in the LICENSE file at https://angular.io/license
|
|
6051
6068
|
*/
|
|
6069
|
+
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6052
6070
|
/**
|
|
6053
6071
|
* The directives defined in the `RouterModule`.
|
|
6054
6072
|
*/
|
|
@@ -6058,11 +6076,15 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6058
6076
|
*
|
|
6059
6077
|
* @publicApi
|
|
6060
6078
|
*/
|
|
6061
|
-
const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION'
|
|
6079
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
|
|
6080
|
+
providedIn: 'root',
|
|
6081
|
+
factory: () => ({}),
|
|
6082
|
+
});
|
|
6062
6083
|
/**
|
|
6063
6084
|
* @docsNotRequired
|
|
6064
6085
|
*/
|
|
6065
|
-
const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
|
|
6086
|
+
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6087
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6066
6088
|
const ROUTER_PROVIDERS = [
|
|
6067
6089
|
Location,
|
|
6068
6090
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
@@ -6077,10 +6099,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6077
6099
|
},
|
|
6078
6100
|
ChildrenOutletContexts,
|
|
6079
6101
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6080
|
-
RouterPreloader,
|
|
6081
|
-
NoPreloading,
|
|
6082
|
-
PreloadAllModules,
|
|
6083
|
-
{ provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
|
|
6084
6102
|
RouterConfigLoader,
|
|
6085
6103
|
];
|
|
6086
6104
|
function routerNgProbeToken() {
|
|
@@ -6133,6 +6151,7 @@ class RouterModule {
|
|
|
6133
6151
|
ngModule: RouterModule,
|
|
6134
6152
|
providers: [
|
|
6135
6153
|
ROUTER_PROVIDERS,
|
|
6154
|
+
NG_DEV_MODE ? ((config === null || config === void 0 ? void 0 : config.enableTracing) ? provideTracing() : []) : [],
|
|
6136
6155
|
provideRoutes(routes),
|
|
6137
6156
|
{
|
|
6138
6157
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6140,22 +6159,11 @@ class RouterModule {
|
|
|
6140
6159
|
deps: [[Router, new Optional(), new SkipSelf()]]
|
|
6141
6160
|
},
|
|
6142
6161
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION]
|
|
6147
|
-
},
|
|
6148
|
-
{
|
|
6149
|
-
provide: RouterScroller,
|
|
6150
|
-
useFactory: createRouterScroller,
|
|
6151
|
-
deps: [Router, ViewportScroller, ROUTER_CONFIGURATION]
|
|
6152
|
-
},
|
|
6153
|
-
{
|
|
6154
|
-
provide: PreloadingStrategy,
|
|
6155
|
-
useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
|
|
6156
|
-
NoPreloading
|
|
6157
|
-
},
|
|
6162
|
+
(config === null || config === void 0 ? void 0 : config.useHash) ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6163
|
+
provideRouterScroller(),
|
|
6164
|
+
(config === null || config === void 0 ? void 0 : config.preloadingStrategy) ? providePreloading(config.preloadingStrategy) : [],
|
|
6158
6165
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6166
|
+
(config === null || config === void 0 ? void 0 : config.initialNavigation) ? provideInitialNavigation(config) : [],
|
|
6159
6167
|
provideRouterInitializer(),
|
|
6160
6168
|
],
|
|
6161
6169
|
};
|
|
@@ -6180,10 +6188,10 @@ class RouterModule {
|
|
|
6180
6188
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6181
6189
|
}
|
|
6182
6190
|
}
|
|
6183
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
6184
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.
|
|
6185
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.
|
|
6186
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
6191
|
+
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6192
|
+
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
|
|
6193
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule });
|
|
6194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, decorators: [{
|
|
6187
6195
|
type: NgModule,
|
|
6188
6196
|
args: [{
|
|
6189
6197
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6199,18 +6207,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
6199
6207
|
type: Optional
|
|
6200
6208
|
}] }];
|
|
6201
6209
|
} });
|
|
6202
|
-
function
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6210
|
+
function provideRouterScroller() {
|
|
6211
|
+
return {
|
|
6212
|
+
provide: ROUTER_SCROLLER,
|
|
6213
|
+
useFactory: () => {
|
|
6214
|
+
const router = inject(Router);
|
|
6215
|
+
const viewportScroller = inject(ViewportScroller);
|
|
6216
|
+
const config = inject(ROUTER_CONFIGURATION);
|
|
6217
|
+
if (config.scrollOffset) {
|
|
6218
|
+
viewportScroller.setOffset(config.scrollOffset);
|
|
6219
|
+
}
|
|
6220
|
+
return new RouterScroller(router, viewportScroller, config);
|
|
6221
|
+
},
|
|
6222
|
+
};
|
|
6223
|
+
}
|
|
6224
|
+
function provideHashLocationStrategy() {
|
|
6225
|
+
return { provide: LocationStrategy, useClass: HashLocationStrategy };
|
|
6207
6226
|
}
|
|
6208
|
-
function
|
|
6209
|
-
return
|
|
6210
|
-
new PathLocationStrategy(platformLocationStrategy, baseHref);
|
|
6227
|
+
function providePathLocationStrategy() {
|
|
6228
|
+
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6211
6229
|
}
|
|
6212
6230
|
function provideForRootGuard(router) {
|
|
6213
|
-
if (
|
|
6231
|
+
if (NG_DEV_MODE && router) {
|
|
6214
6232
|
throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6215
6233
|
}
|
|
6216
6234
|
return 'guarded';
|
|
@@ -6247,17 +6265,6 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
6247
6265
|
}
|
|
6248
6266
|
router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
|
|
6249
6267
|
assignExtraOptionsToRouter(opts, router);
|
|
6250
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && opts.enableTracing) {
|
|
6251
|
-
router.events.subscribe((e) => {
|
|
6252
|
-
var _a, _b;
|
|
6253
|
-
// tslint:disable:no-console
|
|
6254
|
-
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6255
|
-
console.log(stringifyEvent(e));
|
|
6256
|
-
console.log(e);
|
|
6257
|
-
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6258
|
-
// tslint:enable:no-console
|
|
6259
|
-
});
|
|
6260
|
-
}
|
|
6261
6268
|
return router;
|
|
6262
6269
|
}
|
|
6263
6270
|
function assignExtraOptionsToRouter(opts, router) {
|
|
@@ -6286,112 +6293,138 @@ function assignExtraOptionsToRouter(opts, router) {
|
|
|
6286
6293
|
function rootRoute(router) {
|
|
6287
6294
|
return router.routerState.root;
|
|
6288
6295
|
}
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
*
|
|
6295
|
-
* Next, we actually run activation in a `BOOTSTRAP_LISTENER`, using the
|
|
6296
|
-
* `afterPreactivation` hook provided by the router.
|
|
6297
|
-
* The router navigation starts, reaches the point when preactivation is done, and then
|
|
6298
|
-
* pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
|
|
6299
|
-
*/
|
|
6300
|
-
class RouterInitializer {
|
|
6301
|
-
constructor(injector) {
|
|
6302
|
-
this.injector = injector;
|
|
6303
|
-
this.initNavigation = false;
|
|
6304
|
-
this.destroyed = false;
|
|
6305
|
-
this.resultOfPreactivationDone = new Subject();
|
|
6306
|
-
}
|
|
6307
|
-
appInitializer() {
|
|
6308
|
-
const p = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6309
|
-
return p.then(() => {
|
|
6310
|
-
// If the injector was destroyed, the DI lookups below will fail.
|
|
6311
|
-
if (this.destroyed) {
|
|
6312
|
-
return Promise.resolve(true);
|
|
6313
|
-
}
|
|
6314
|
-
let resolve = null;
|
|
6315
|
-
const res = new Promise(r => resolve = r);
|
|
6316
|
-
const router = this.injector.get(Router);
|
|
6317
|
-
const opts = this.injector.get(ROUTER_CONFIGURATION);
|
|
6318
|
-
if (opts.initialNavigation === 'disabled') {
|
|
6319
|
-
router.setUpLocationChangeListener();
|
|
6320
|
-
resolve(true);
|
|
6321
|
-
}
|
|
6322
|
-
else if (opts.initialNavigation === 'enabledBlocking') {
|
|
6323
|
-
router.afterPreactivation = () => {
|
|
6324
|
-
// only the initial navigation should be delayed
|
|
6325
|
-
if (!this.initNavigation) {
|
|
6326
|
-
this.initNavigation = true;
|
|
6327
|
-
resolve(true);
|
|
6328
|
-
return this.resultOfPreactivationDone;
|
|
6329
|
-
// subsequent navigations should not be delayed
|
|
6330
|
-
}
|
|
6331
|
-
else {
|
|
6332
|
-
return of(void 0);
|
|
6333
|
-
}
|
|
6334
|
-
};
|
|
6335
|
-
router.initialNavigation();
|
|
6336
|
-
}
|
|
6337
|
-
else {
|
|
6338
|
-
resolve(true);
|
|
6339
|
-
}
|
|
6340
|
-
return res;
|
|
6341
|
-
});
|
|
6342
|
-
}
|
|
6343
|
-
bootstrapListener(bootstrappedComponentRef) {
|
|
6344
|
-
const opts = this.injector.get(ROUTER_CONFIGURATION);
|
|
6345
|
-
const preloader = this.injector.get(RouterPreloader);
|
|
6346
|
-
const routerScroller = this.injector.get(RouterScroller);
|
|
6347
|
-
const router = this.injector.get(Router);
|
|
6348
|
-
const ref = this.injector.get(ApplicationRef);
|
|
6296
|
+
function getBootstrapListener() {
|
|
6297
|
+
const injector = inject(Injector);
|
|
6298
|
+
return (bootstrappedComponentRef) => {
|
|
6299
|
+
var _a, _b;
|
|
6300
|
+
const ref = injector.get(ApplicationRef);
|
|
6349
6301
|
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6350
6302
|
return;
|
|
6351
6303
|
}
|
|
6304
|
+
const router = injector.get(Router);
|
|
6305
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6352
6306
|
// Default case
|
|
6353
|
-
if (
|
|
6307
|
+
if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
|
|
6354
6308
|
router.initialNavigation();
|
|
6355
6309
|
}
|
|
6356
|
-
|
|
6357
|
-
|
|
6310
|
+
(_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
|
|
6311
|
+
(_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
|
|
6358
6312
|
router.resetRootComponentType(ref.componentTypes[0]);
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
}
|
|
6362
|
-
ngOnDestroy() {
|
|
6363
|
-
this.destroyed = true;
|
|
6364
|
-
}
|
|
6365
|
-
}
|
|
6366
|
-
RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6367
|
-
RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: RouterInitializer });
|
|
6368
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: RouterInitializer, decorators: [{
|
|
6369
|
-
type: Injectable
|
|
6370
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
6371
|
-
function getAppInitializer(r) {
|
|
6372
|
-
return r.appInitializer.bind(r);
|
|
6373
|
-
}
|
|
6374
|
-
function getBootstrapListener(r) {
|
|
6375
|
-
return r.bootstrapListener.bind(r);
|
|
6313
|
+
bootstrapDone.next();
|
|
6314
|
+
bootstrapDone.complete();
|
|
6315
|
+
};
|
|
6376
6316
|
}
|
|
6317
|
+
// TODO(atscott): This should not be in the public API
|
|
6377
6318
|
/**
|
|
6378
6319
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
6379
6320
|
* is called after the app is bootstrapped.
|
|
6380
6321
|
*
|
|
6381
6322
|
* @publicApi
|
|
6382
6323
|
*/
|
|
6383
|
-
const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
|
|
6324
|
+
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6325
|
+
function provideInitialNavigation(config) {
|
|
6326
|
+
return [
|
|
6327
|
+
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6328
|
+
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6329
|
+
];
|
|
6330
|
+
}
|
|
6384
6331
|
function provideRouterInitializer() {
|
|
6385
6332
|
return [
|
|
6386
|
-
|
|
6333
|
+
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
6334
|
+
// have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
|
|
6335
|
+
{ provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener },
|
|
6336
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6337
|
+
];
|
|
6338
|
+
}
|
|
6339
|
+
/**
|
|
6340
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6341
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6342
|
+
* to the activation phase.
|
|
6343
|
+
*/
|
|
6344
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6345
|
+
factory: () => {
|
|
6346
|
+
return new Subject();
|
|
6347
|
+
}
|
|
6348
|
+
});
|
|
6349
|
+
function provideEnabledBlockingInitialNavigation() {
|
|
6350
|
+
return [
|
|
6351
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
|
|
6387
6352
|
{
|
|
6388
6353
|
provide: APP_INITIALIZER,
|
|
6389
6354
|
multi: true,
|
|
6390
|
-
|
|
6391
|
-
|
|
6355
|
+
deps: [Injector],
|
|
6356
|
+
useFactory: (injector) => {
|
|
6357
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6358
|
+
let initNavigation = false;
|
|
6359
|
+
return () => {
|
|
6360
|
+
return locationInitialized.then(() => {
|
|
6361
|
+
return new Promise(resolve => {
|
|
6362
|
+
const router = injector.get(Router);
|
|
6363
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6364
|
+
router.afterPreactivation = () => {
|
|
6365
|
+
// only the initial navigation should be delayed
|
|
6366
|
+
if (!initNavigation) {
|
|
6367
|
+
initNavigation = true;
|
|
6368
|
+
resolve(true);
|
|
6369
|
+
return bootstrapDone;
|
|
6370
|
+
// subsequent navigations should not be delayed
|
|
6371
|
+
}
|
|
6372
|
+
else {
|
|
6373
|
+
return of(void 0);
|
|
6374
|
+
}
|
|
6375
|
+
};
|
|
6376
|
+
router.initialNavigation();
|
|
6377
|
+
});
|
|
6378
|
+
});
|
|
6379
|
+
};
|
|
6380
|
+
}
|
|
6392
6381
|
},
|
|
6393
|
-
|
|
6394
|
-
|
|
6382
|
+
];
|
|
6383
|
+
}
|
|
6384
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
|
|
6385
|
+
function provideDisabledInitialNavigation() {
|
|
6386
|
+
return [
|
|
6387
|
+
{
|
|
6388
|
+
provide: APP_INITIALIZER,
|
|
6389
|
+
multi: true,
|
|
6390
|
+
useFactory: () => {
|
|
6391
|
+
const router = inject(Router);
|
|
6392
|
+
return () => {
|
|
6393
|
+
router.setUpLocationChangeListener();
|
|
6394
|
+
};
|
|
6395
|
+
}
|
|
6396
|
+
},
|
|
6397
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'disabled' }
|
|
6398
|
+
];
|
|
6399
|
+
}
|
|
6400
|
+
function provideTracing() {
|
|
6401
|
+
if (NG_DEV_MODE) {
|
|
6402
|
+
return [{
|
|
6403
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6404
|
+
multi: true,
|
|
6405
|
+
useFactory: () => {
|
|
6406
|
+
const router = inject(Router);
|
|
6407
|
+
return () => router.events.subscribe((e) => {
|
|
6408
|
+
var _a, _b;
|
|
6409
|
+
// tslint:disable:no-console
|
|
6410
|
+
(_a = console.group) === null || _a === void 0 ? void 0 : _a.call(console, `Router Event: ${e.constructor.name}`);
|
|
6411
|
+
console.log(stringifyEvent(e));
|
|
6412
|
+
console.log(e);
|
|
6413
|
+
(_b = console.groupEnd) === null || _b === void 0 ? void 0 : _b.call(console);
|
|
6414
|
+
// tslint:enable:no-console
|
|
6415
|
+
});
|
|
6416
|
+
}
|
|
6417
|
+
}];
|
|
6418
|
+
}
|
|
6419
|
+
else {
|
|
6420
|
+
return [];
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
function providePreloading(preloadingStrategy) {
|
|
6424
|
+
return [
|
|
6425
|
+
RouterPreloader,
|
|
6426
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6427
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6395
6428
|
];
|
|
6396
6429
|
}
|
|
6397
6430
|
|
|
@@ -6405,7 +6438,7 @@ function provideRouterInitializer() {
|
|
|
6405
6438
|
/**
|
|
6406
6439
|
* @publicApi
|
|
6407
6440
|
*/
|
|
6408
|
-
const VERSION = new Version('14.0.
|
|
6441
|
+
const VERSION = new Version('14.0.4');
|
|
6409
6442
|
|
|
6410
6443
|
/**
|
|
6411
6444
|
* @license
|
|
@@ -6444,5 +6477,5 @@ const VERSION = new Version('14.0.3');
|
|
|
6444
6477
|
* Generated bundle index. Do not edit.
|
|
6445
6478
|
*/
|
|
6446
6479
|
|
|
6447
|
-
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, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
|
|
6480
|
+
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, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
|
|
6448
6481
|
//# sourceMappingURL=router.mjs.map
|