@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/fesm2020/router.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 i3 from '@angular/common';
|
|
8
|
-
import { Location, LocationStrategy,
|
|
8
|
+
import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
|
-
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,
|
|
10
|
+
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';
|
|
11
11
|
import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
|
|
12
12
|
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';
|
|
13
13
|
import * as i1 from '@angular/platform-browser';
|
|
@@ -2230,7 +2230,10 @@ class RouterOutlet {
|
|
|
2230
2230
|
}
|
|
2231
2231
|
/** @nodoc */
|
|
2232
2232
|
ngOnDestroy() {
|
|
2233
|
-
this.
|
|
2233
|
+
// Ensure that the registered outlet is this one before removing it on the context.
|
|
2234
|
+
if (this.parentContexts.getContext(this.name)?.outlet === this) {
|
|
2235
|
+
this.parentContexts.onChildOutletDestroyed(this.name);
|
|
2236
|
+
}
|
|
2234
2237
|
}
|
|
2235
2238
|
/** @nodoc */
|
|
2236
2239
|
ngOnInit() {
|
|
@@ -2328,9 +2331,9 @@ class RouterOutlet {
|
|
|
2328
2331
|
this.activateEvents.emit(this.activated.instance);
|
|
2329
2332
|
}
|
|
2330
2333
|
}
|
|
2331
|
-
RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2332
|
-
RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
2333
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2334
|
+
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 });
|
|
2335
|
+
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 });
|
|
2336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterOutlet, decorators: [{
|
|
2334
2337
|
type: Directive,
|
|
2335
2338
|
args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
|
|
2336
2339
|
}], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
@@ -2387,9 +2390,9 @@ function isComponentFactoryResolver(item) {
|
|
|
2387
2390
|
*/
|
|
2388
2391
|
class ɵEmptyOutletComponent {
|
|
2389
2392
|
}
|
|
2390
|
-
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2391
|
-
ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.
|
|
2392
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2393
|
+
ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2394
|
+
ɵ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"] }] });
|
|
2395
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
|
|
2393
2396
|
type: Component,
|
|
2394
2397
|
args: [{ template: `<router-outlet></router-outlet>` }]
|
|
2395
2398
|
}] });
|
|
@@ -3651,7 +3654,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
|
|
|
3651
3654
|
* Use of this source code is governed by an MIT-style license that can be
|
|
3652
3655
|
* found in the LICENSE file at https://angular.io/license
|
|
3653
3656
|
*/
|
|
3654
|
-
const NG_DEV_MODE$
|
|
3657
|
+
const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
3655
3658
|
class NoMatch {
|
|
3656
3659
|
}
|
|
3657
3660
|
function newObservableError(e) {
|
|
@@ -3772,7 +3775,7 @@ class Recognizer {
|
|
|
3772
3775
|
// NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
|
|
3773
3776
|
// production bundle size. This value is intended only to surface a warning to users
|
|
3774
3777
|
// depending on `relativeLinkResolution: 'legacy'` in dev mode.
|
|
3775
|
-
(NG_DEV_MODE$
|
|
3778
|
+
(NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
|
|
3776
3779
|
pathIndexShift));
|
|
3777
3780
|
}
|
|
3778
3781
|
else {
|
|
@@ -3783,7 +3786,7 @@ class Recognizer {
|
|
|
3783
3786
|
consumedSegments = result.consumedSegments;
|
|
3784
3787
|
remainingSegments = result.remainingSegments;
|
|
3785
3788
|
const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
|
|
3786
|
-
snapshot = new ActivatedRouteSnapshot(consumedSegments, result.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$
|
|
3789
|
+
snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
|
|
3787
3790
|
pathIndexShift));
|
|
3788
3791
|
}
|
|
3789
3792
|
const childConfig = getChildConfig(route);
|
|
@@ -4087,7 +4090,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
|
|
|
4087
4090
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4088
4091
|
* found in the LICENSE file at https://angular.io/license
|
|
4089
4092
|
*/
|
|
4090
|
-
const NG_DEV_MODE$
|
|
4093
|
+
const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4091
4094
|
/**
|
|
4092
4095
|
* The [DI token](guide/glossary/#di-token) for a router configuration.
|
|
4093
4096
|
*
|
|
@@ -4121,7 +4124,7 @@ class RouterConfigLoader {
|
|
|
4121
4124
|
if (this.onLoadEndListener) {
|
|
4122
4125
|
this.onLoadEndListener(route);
|
|
4123
4126
|
}
|
|
4124
|
-
NG_DEV_MODE$
|
|
4127
|
+
NG_DEV_MODE$2 && assertStandalone(route.path ?? '', component);
|
|
4125
4128
|
route._loadedComponent = component;
|
|
4126
4129
|
}), finalize(() => {
|
|
4127
4130
|
this.componentLoaders.delete(route);
|
|
@@ -4164,7 +4167,7 @@ class RouterConfigLoader {
|
|
|
4164
4167
|
rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
|
|
4165
4168
|
}
|
|
4166
4169
|
const routes = rawRoutes.map(standardizeConfig);
|
|
4167
|
-
NG_DEV_MODE$
|
|
4170
|
+
NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
|
|
4168
4171
|
return { routes, injector };
|
|
4169
4172
|
}), finalize(() => {
|
|
4170
4173
|
this.childrenLoaders.delete(route);
|
|
@@ -4186,9 +4189,9 @@ class RouterConfigLoader {
|
|
|
4186
4189
|
}));
|
|
4187
4190
|
}
|
|
4188
4191
|
}
|
|
4189
|
-
RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
4190
|
-
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
4191
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
4192
|
+
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 });
|
|
4193
|
+
RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader });
|
|
4194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader, decorators: [{
|
|
4192
4195
|
type: Injectable
|
|
4193
4196
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
|
|
4194
4197
|
|
|
@@ -4230,7 +4233,7 @@ class DefaultUrlHandlingStrategy {
|
|
|
4230
4233
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4231
4234
|
* found in the LICENSE file at https://angular.io/license
|
|
4232
4235
|
*/
|
|
4233
|
-
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4236
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
4234
4237
|
function defaultErrorHandler(error) {
|
|
4235
4238
|
throw error;
|
|
4236
4239
|
}
|
|
@@ -4809,7 +4812,7 @@ class Router {
|
|
|
4809
4812
|
* ```
|
|
4810
4813
|
*/
|
|
4811
4814
|
resetConfig(config) {
|
|
4812
|
-
NG_DEV_MODE && validateConfig(config);
|
|
4815
|
+
NG_DEV_MODE$1 && validateConfig(config);
|
|
4813
4816
|
this.config = config.map(standardizeConfig);
|
|
4814
4817
|
this.navigated = false;
|
|
4815
4818
|
this.lastSuccessfulId = -1;
|
|
@@ -5164,9 +5167,9 @@ class Router {
|
|
|
5164
5167
|
return { navigationId };
|
|
5165
5168
|
}
|
|
5166
5169
|
}
|
|
5167
|
-
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5168
|
-
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5169
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5170
|
+
Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
5171
|
+
Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router });
|
|
5172
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, decorators: [{
|
|
5170
5173
|
type: Injectable
|
|
5171
5174
|
}], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
|
|
5172
5175
|
function validateCommands(commands) {
|
|
@@ -5365,9 +5368,9 @@ class RouterLink {
|
|
|
5365
5368
|
});
|
|
5366
5369
|
}
|
|
5367
5370
|
}
|
|
5368
|
-
RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5369
|
-
RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5370
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5371
|
+
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 });
|
|
5372
|
+
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 });
|
|
5373
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLink, decorators: [{
|
|
5371
5374
|
type: Directive,
|
|
5372
5375
|
args: [{ selector: ':not(a):not(area)[routerLink]' }]
|
|
5373
5376
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
|
|
@@ -5484,9 +5487,9 @@ class RouterLinkWithHref {
|
|
|
5484
5487
|
});
|
|
5485
5488
|
}
|
|
5486
5489
|
}
|
|
5487
|
-
RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5488
|
-
RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5489
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5490
|
+
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 });
|
|
5491
|
+
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 });
|
|
5492
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkWithHref, decorators: [{
|
|
5490
5493
|
type: Directive,
|
|
5491
5494
|
args: [{ selector: 'a[routerLink],area[routerLink]' }]
|
|
5492
5495
|
}], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
|
|
@@ -5711,9 +5714,9 @@ class RouterLinkActive {
|
|
|
5711
5714
|
this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
|
5712
5715
|
}
|
|
5713
5716
|
}
|
|
5714
|
-
RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5715
|
-
RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
5716
|
-
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: [{
|
|
5717
5720
|
type: Directive,
|
|
5718
5721
|
args: [{
|
|
5719
5722
|
selector: '[routerLinkActive]',
|
|
@@ -5816,9 +5819,9 @@ class DefaultTitleStrategy extends TitleStrategy {
|
|
|
5816
5819
|
}
|
|
5817
5820
|
}
|
|
5818
5821
|
}
|
|
5819
|
-
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5820
|
-
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5821
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5822
|
+
DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5823
|
+
DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
|
|
5824
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
|
|
5822
5825
|
type: Injectable,
|
|
5823
5826
|
args: [{ providedIn: 'root' }]
|
|
5824
5827
|
}], ctorParameters: function () { return [{ type: i1.Title }]; } });
|
|
@@ -5855,6 +5858,12 @@ class PreloadAllModules {
|
|
|
5855
5858
|
return fn().pipe(catchError(() => of(null)));
|
|
5856
5859
|
}
|
|
5857
5860
|
}
|
|
5861
|
+
PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5862
|
+
PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
|
|
5863
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, decorators: [{
|
|
5864
|
+
type: Injectable,
|
|
5865
|
+
args: [{ providedIn: 'root' }]
|
|
5866
|
+
}] });
|
|
5858
5867
|
/**
|
|
5859
5868
|
* @description
|
|
5860
5869
|
*
|
|
@@ -5869,6 +5878,12 @@ class NoPreloading {
|
|
|
5869
5878
|
return of(null);
|
|
5870
5879
|
}
|
|
5871
5880
|
}
|
|
5881
|
+
NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5882
|
+
NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
|
|
5883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, decorators: [{
|
|
5884
|
+
type: Injectable,
|
|
5885
|
+
args: [{ providedIn: 'root' }]
|
|
5886
|
+
}] });
|
|
5872
5887
|
/**
|
|
5873
5888
|
* The preloader optimistically loads all router configurations to
|
|
5874
5889
|
* make navigations into lazily-loaded sections of the application faster.
|
|
@@ -5951,9 +5966,9 @@ class RouterPreloader {
|
|
|
5951
5966
|
});
|
|
5952
5967
|
}
|
|
5953
5968
|
}
|
|
5954
|
-
RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
5955
|
-
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
5956
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
5969
|
+
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 });
|
|
5970
|
+
RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader });
|
|
5971
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader, decorators: [{
|
|
5957
5972
|
type: Injectable
|
|
5958
5973
|
}], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
|
|
5959
5974
|
|
|
@@ -5964,6 +5979,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
5964
5979
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5965
5980
|
* found in the LICENSE file at https://angular.io/license
|
|
5966
5981
|
*/
|
|
5982
|
+
const ROUTER_SCROLLER = new InjectionToken('');
|
|
5967
5983
|
class RouterScroller {
|
|
5968
5984
|
constructor(router,
|
|
5969
5985
|
/** @docsNotRequired */ viewportScroller, options = {}) {
|
|
@@ -6039,9 +6055,9 @@ class RouterScroller {
|
|
|
6039
6055
|
}
|
|
6040
6056
|
}
|
|
6041
6057
|
}
|
|
6042
|
-
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
6043
|
-
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
6044
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
6058
|
+
RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
6059
|
+
RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller });
|
|
6060
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, decorators: [{
|
|
6045
6061
|
type: Injectable
|
|
6046
6062
|
}], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
|
|
6047
6063
|
|
|
@@ -6052,6 +6068,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
6052
6068
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6053
6069
|
* found in the LICENSE file at https://angular.io/license
|
|
6054
6070
|
*/
|
|
6071
|
+
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
6055
6072
|
/**
|
|
6056
6073
|
* The directives defined in the `RouterModule`.
|
|
6057
6074
|
*/
|
|
@@ -6061,11 +6078,15 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
|
|
|
6061
6078
|
*
|
|
6062
6079
|
* @publicApi
|
|
6063
6080
|
*/
|
|
6064
|
-
const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION'
|
|
6081
|
+
const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
|
|
6082
|
+
providedIn: 'root',
|
|
6083
|
+
factory: () => ({}),
|
|
6084
|
+
});
|
|
6065
6085
|
/**
|
|
6066
6086
|
* @docsNotRequired
|
|
6067
6087
|
*/
|
|
6068
|
-
const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
|
|
6088
|
+
const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
|
|
6089
|
+
const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
|
|
6069
6090
|
const ROUTER_PROVIDERS = [
|
|
6070
6091
|
Location,
|
|
6071
6092
|
{ provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
|
@@ -6080,10 +6101,6 @@ const ROUTER_PROVIDERS = [
|
|
|
6080
6101
|
},
|
|
6081
6102
|
ChildrenOutletContexts,
|
|
6082
6103
|
{ provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
|
6083
|
-
RouterPreloader,
|
|
6084
|
-
NoPreloading,
|
|
6085
|
-
PreloadAllModules,
|
|
6086
|
-
{ provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
|
|
6087
6104
|
RouterConfigLoader,
|
|
6088
6105
|
];
|
|
6089
6106
|
function routerNgProbeToken() {
|
|
@@ -6136,6 +6153,7 @@ class RouterModule {
|
|
|
6136
6153
|
ngModule: RouterModule,
|
|
6137
6154
|
providers: [
|
|
6138
6155
|
ROUTER_PROVIDERS,
|
|
6156
|
+
NG_DEV_MODE ? (config?.enableTracing ? provideTracing() : []) : [],
|
|
6139
6157
|
provideRoutes(routes),
|
|
6140
6158
|
{
|
|
6141
6159
|
provide: ROUTER_FORROOT_GUARD,
|
|
@@ -6143,22 +6161,11 @@ class RouterModule {
|
|
|
6143
6161
|
deps: [[Router, new Optional(), new SkipSelf()]]
|
|
6144
6162
|
},
|
|
6145
6163
|
{ provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION]
|
|
6150
|
-
},
|
|
6151
|
-
{
|
|
6152
|
-
provide: RouterScroller,
|
|
6153
|
-
useFactory: createRouterScroller,
|
|
6154
|
-
deps: [Router, ViewportScroller, ROUTER_CONFIGURATION]
|
|
6155
|
-
},
|
|
6156
|
-
{
|
|
6157
|
-
provide: PreloadingStrategy,
|
|
6158
|
-
useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
|
|
6159
|
-
NoPreloading
|
|
6160
|
-
},
|
|
6164
|
+
config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
|
|
6165
|
+
provideRouterScroller(),
|
|
6166
|
+
config?.preloadingStrategy ? providePreloading(config.preloadingStrategy) : [],
|
|
6161
6167
|
{ provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
|
6168
|
+
config?.initialNavigation ? provideInitialNavigation(config) : [],
|
|
6162
6169
|
provideRouterInitializer(),
|
|
6163
6170
|
],
|
|
6164
6171
|
};
|
|
@@ -6183,10 +6190,10 @@ class RouterModule {
|
|
|
6183
6190
|
return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
|
|
6184
6191
|
}
|
|
6185
6192
|
}
|
|
6186
|
-
RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
6187
|
-
RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.
|
|
6188
|
-
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.
|
|
6189
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
6193
|
+
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 });
|
|
6194
|
+
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] });
|
|
6195
|
+
RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule });
|
|
6196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, decorators: [{
|
|
6190
6197
|
type: NgModule,
|
|
6191
6198
|
args: [{
|
|
6192
6199
|
declarations: ROUTER_DIRECTIVES,
|
|
@@ -6200,18 +6207,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
6200
6207
|
}] }, { type: Router, decorators: [{
|
|
6201
6208
|
type: Optional
|
|
6202
6209
|
}] }]; } });
|
|
6203
|
-
function
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
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 };
|
|
6208
6226
|
}
|
|
6209
|
-
function
|
|
6210
|
-
return
|
|
6211
|
-
new PathLocationStrategy(platformLocationStrategy, baseHref);
|
|
6227
|
+
function providePathLocationStrategy() {
|
|
6228
|
+
return { provide: LocationStrategy, useClass: PathLocationStrategy };
|
|
6212
6229
|
}
|
|
6213
6230
|
function provideForRootGuard(router) {
|
|
6214
|
-
if (
|
|
6231
|
+
if (NG_DEV_MODE && router) {
|
|
6215
6232
|
throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
|
|
6216
6233
|
}
|
|
6217
6234
|
return 'guarded';
|
|
@@ -6248,16 +6265,6 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
|
|
|
6248
6265
|
}
|
|
6249
6266
|
router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
|
|
6250
6267
|
assignExtraOptionsToRouter(opts, router);
|
|
6251
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && opts.enableTracing) {
|
|
6252
|
-
router.events.subscribe((e) => {
|
|
6253
|
-
// tslint:disable:no-console
|
|
6254
|
-
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6255
|
-
console.log(stringifyEvent(e));
|
|
6256
|
-
console.log(e);
|
|
6257
|
-
console.groupEnd?.();
|
|
6258
|
-
// tslint:enable:no-console
|
|
6259
|
-
});
|
|
6260
|
-
}
|
|
6261
6268
|
return router;
|
|
6262
6269
|
}
|
|
6263
6270
|
function assignExtraOptionsToRouter(opts, router) {
|
|
@@ -6286,112 +6293,136 @@ function assignExtraOptionsToRouter(opts, router) {
|
|
|
6286
6293
|
function rootRoute(router) {
|
|
6287
6294
|
return router.routerState.root;
|
|
6288
6295
|
}
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
* a resolver or a guard executes asynchronously.
|
|
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
|
+
const ref = injector.get(ApplicationRef);
|
|
6349
6300
|
if (bootstrappedComponentRef !== ref.components[0]) {
|
|
6350
6301
|
return;
|
|
6351
6302
|
}
|
|
6303
|
+
const router = injector.get(Router);
|
|
6304
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6352
6305
|
// Default case
|
|
6353
|
-
if (
|
|
6306
|
+
if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
|
|
6354
6307
|
router.initialNavigation();
|
|
6355
6308
|
}
|
|
6356
|
-
|
|
6357
|
-
|
|
6309
|
+
injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
|
|
6310
|
+
injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
|
|
6358
6311
|
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);
|
|
6312
|
+
bootstrapDone.next();
|
|
6313
|
+
bootstrapDone.complete();
|
|
6314
|
+
};
|
|
6376
6315
|
}
|
|
6316
|
+
// TODO(atscott): This should not be in the public API
|
|
6377
6317
|
/**
|
|
6378
6318
|
* A [DI token](guide/glossary/#di-token) for the router initializer that
|
|
6379
6319
|
* is called after the app is bootstrapped.
|
|
6380
6320
|
*
|
|
6381
6321
|
* @publicApi
|
|
6382
6322
|
*/
|
|
6383
|
-
const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
|
|
6323
|
+
const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
|
|
6324
|
+
function provideInitialNavigation(config) {
|
|
6325
|
+
return [
|
|
6326
|
+
config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
|
|
6327
|
+
config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
|
|
6328
|
+
];
|
|
6329
|
+
}
|
|
6384
6330
|
function provideRouterInitializer() {
|
|
6385
6331
|
return [
|
|
6386
|
-
|
|
6332
|
+
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
|
|
6333
|
+
// have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
|
|
6334
|
+
{ provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener },
|
|
6335
|
+
{ provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
|
6336
|
+
];
|
|
6337
|
+
}
|
|
6338
|
+
/**
|
|
6339
|
+
* A subject used to indicate that the bootstrapping phase is done. When initial navigation is
|
|
6340
|
+
* `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
|
|
6341
|
+
* to the activation phase.
|
|
6342
|
+
*/
|
|
6343
|
+
const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
|
|
6344
|
+
factory: () => {
|
|
6345
|
+
return new Subject();
|
|
6346
|
+
}
|
|
6347
|
+
});
|
|
6348
|
+
function provideEnabledBlockingInitialNavigation() {
|
|
6349
|
+
return [
|
|
6350
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
|
|
6351
|
+
{
|
|
6352
|
+
provide: APP_INITIALIZER,
|
|
6353
|
+
multi: true,
|
|
6354
|
+
deps: [Injector],
|
|
6355
|
+
useFactory: (injector) => {
|
|
6356
|
+
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
|
|
6357
|
+
let initNavigation = false;
|
|
6358
|
+
return () => {
|
|
6359
|
+
return locationInitialized.then(() => {
|
|
6360
|
+
return new Promise(resolve => {
|
|
6361
|
+
const router = injector.get(Router);
|
|
6362
|
+
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
|
|
6363
|
+
router.afterPreactivation = () => {
|
|
6364
|
+
// only the initial navigation should be delayed
|
|
6365
|
+
if (!initNavigation) {
|
|
6366
|
+
initNavigation = true;
|
|
6367
|
+
resolve(true);
|
|
6368
|
+
return bootstrapDone;
|
|
6369
|
+
// subsequent navigations should not be delayed
|
|
6370
|
+
}
|
|
6371
|
+
else {
|
|
6372
|
+
return of(void 0);
|
|
6373
|
+
}
|
|
6374
|
+
};
|
|
6375
|
+
router.initialNavigation();
|
|
6376
|
+
});
|
|
6377
|
+
});
|
|
6378
|
+
};
|
|
6379
|
+
}
|
|
6380
|
+
},
|
|
6381
|
+
];
|
|
6382
|
+
}
|
|
6383
|
+
const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
|
|
6384
|
+
function provideDisabledInitialNavigation() {
|
|
6385
|
+
return [
|
|
6387
6386
|
{
|
|
6388
6387
|
provide: APP_INITIALIZER,
|
|
6389
6388
|
multi: true,
|
|
6390
|
-
useFactory:
|
|
6391
|
-
|
|
6389
|
+
useFactory: () => {
|
|
6390
|
+
const router = inject(Router);
|
|
6391
|
+
return () => {
|
|
6392
|
+
router.setUpLocationChangeListener();
|
|
6393
|
+
};
|
|
6394
|
+
}
|
|
6392
6395
|
},
|
|
6393
|
-
{ provide:
|
|
6394
|
-
|
|
6396
|
+
{ provide: INITIAL_NAVIGATION, useValue: 'disabled' }
|
|
6397
|
+
];
|
|
6398
|
+
}
|
|
6399
|
+
function provideTracing() {
|
|
6400
|
+
if (NG_DEV_MODE) {
|
|
6401
|
+
return [{
|
|
6402
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
6403
|
+
multi: true,
|
|
6404
|
+
useFactory: () => {
|
|
6405
|
+
const router = inject(Router);
|
|
6406
|
+
return () => router.events.subscribe((e) => {
|
|
6407
|
+
// tslint:disable:no-console
|
|
6408
|
+
console.group?.(`Router Event: ${e.constructor.name}`);
|
|
6409
|
+
console.log(stringifyEvent(e));
|
|
6410
|
+
console.log(e);
|
|
6411
|
+
console.groupEnd?.();
|
|
6412
|
+
// tslint:enable:no-console
|
|
6413
|
+
});
|
|
6414
|
+
}
|
|
6415
|
+
}];
|
|
6416
|
+
}
|
|
6417
|
+
else {
|
|
6418
|
+
return [];
|
|
6419
|
+
}
|
|
6420
|
+
}
|
|
6421
|
+
function providePreloading(preloadingStrategy) {
|
|
6422
|
+
return [
|
|
6423
|
+
RouterPreloader,
|
|
6424
|
+
{ provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
|
|
6425
|
+
{ provide: PreloadingStrategy, useExisting: preloadingStrategy },
|
|
6395
6426
|
];
|
|
6396
6427
|
}
|
|
6397
6428
|
|
|
@@ -6405,7 +6436,7 @@ function provideRouterInitializer() {
|
|
|
6405
6436
|
/**
|
|
6406
6437
|
* @publicApi
|
|
6407
6438
|
*/
|
|
6408
|
-
const VERSION = new Version('14.0.
|
|
6439
|
+
const VERSION = new Version('14.0.4');
|
|
6409
6440
|
|
|
6410
6441
|
/**
|
|
6411
6442
|
* @license
|
|
@@ -6444,5 +6475,5 @@ const VERSION = new Version('14.0.3');
|
|
|
6444
6475
|
* Generated bundle index. Do not edit.
|
|
6445
6476
|
*/
|
|
6446
6477
|
|
|
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 };
|
|
6478
|
+
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
6479
|
//# sourceMappingURL=router.mjs.map
|