@angular/router 15.0.1 → 15.0.3

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.
Files changed (36) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/deprecated_load_children.mjs +3 -1
  3. package/esm2020/src/directives/router_link.mjs +3 -3
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +3 -3
  6. package/esm2020/src/models.mjs +1 -1
  7. package/esm2020/src/navigation_transition.mjs +138 -78
  8. package/esm2020/src/page_title_strategy.mjs +6 -6
  9. package/esm2020/src/private_export.mjs +1 -2
  10. package/esm2020/src/provide_router.mjs +6 -7
  11. package/esm2020/src/route_reuse_strategy.mjs +6 -6
  12. package/esm2020/src/router.mjs +49 -147
  13. package/esm2020/src/router_config_loader.mjs +3 -3
  14. package/esm2020/src/router_module.mjs +11 -9
  15. package/esm2020/src/router_outlet_context.mjs +3 -3
  16. package/esm2020/src/router_preloader.mjs +9 -9
  17. package/esm2020/src/router_scroller.mjs +20 -21
  18. package/esm2020/src/router_state.mjs +1 -1
  19. package/esm2020/src/url_handling_strategy.mjs +6 -6
  20. package/esm2020/src/url_tree.mjs +4 -4
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/router_testing_module.mjs +47 -55
  23. package/fesm2015/router.mjs +400 -436
  24. package/fesm2015/router.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +48 -56
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2015/upgrade.mjs +1 -1
  28. package/fesm2020/router.mjs +394 -434
  29. package/fesm2020/router.mjs.map +1 -1
  30. package/fesm2020/testing.mjs +48 -56
  31. package/fesm2020/testing.mjs.map +1 -1
  32. package/fesm2020/upgrade.mjs +1 -1
  33. package/index.d.ts +16 -37
  34. package/package.json +4 -4
  35. package/testing/index.d.ts +1 -7
  36. package/upgrade/index.d.ts +1 -1
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v15.0.1
2
+ * @license Angular v15.0.3
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, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
8
+ import { ɵisObservable, ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, APP_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
11
  import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
@@ -461,9 +461,9 @@ function mapChildrenIntoArray(segment, fn) {
461
461
  */
462
462
  class UrlSerializer {
463
463
  }
464
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, decorators: [{
464
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlSerializer, decorators: [{
467
467
  type: Injectable,
468
468
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
469
469
  }] });
@@ -2380,9 +2380,9 @@ class ChildrenOutletContexts {
2380
2380
  return this.contexts.get(childName) || null;
2381
2381
  }
2382
2382
  }
2383
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2384
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2383
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2384
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2386
2386
  type: Injectable,
2387
2387
  args: [{ providedIn: 'root' }]
2388
2388
  }] });
@@ -2602,9 +2602,9 @@ class RouterOutlet {
2602
2602
  this.activateEvents.emit(this.activated.instance);
2603
2603
  }
2604
2604
  }
2605
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2606
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2607
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, decorators: [{
2605
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2606
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2607
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterOutlet, decorators: [{
2608
2608
  type: Directive,
2609
2609
  args: [{
2610
2610
  selector: 'router-outlet',
@@ -2664,9 +2664,9 @@ function isComponentFactoryResolver(item) {
2664
2664
  */
2665
2665
  class ɵEmptyOutletComponent {
2666
2666
  }
2667
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2668
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2669
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2667
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2668
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2669
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2670
2670
  type: Component,
2671
2671
  args: [{
2672
2672
  template: `<router-outlet></router-outlet>`,
@@ -4285,6 +4285,19 @@ function switchTap(next) {
4285
4285
  });
4286
4286
  }
4287
4287
 
4288
+ /**
4289
+ * @license
4290
+ * Copyright Google LLC All Rights Reserved.
4291
+ *
4292
+ * Use of this source code is governed by an MIT-style license that can be
4293
+ * found in the LICENSE file at https://angular.io/license
4294
+ */
4295
+ // This file exists to support the legacy `loadChildren: string` behavior being patched back into
4296
+ // Angular.
4297
+ function deprecatedLoadChildrenString(injector, loadChildren) {
4298
+ return null;
4299
+ }
4300
+
4288
4301
  /**
4289
4302
  * @license
4290
4303
  * Copyright Google LLC All Rights Reserved.
@@ -4293,16 +4306,185 @@ function switchTap(next) {
4293
4306
  * found in the LICENSE file at https://angular.io/license
4294
4307
  */
4295
4308
  const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4309
+ /**
4310
+ * The [DI token](guide/glossary/#di-token) for a router configuration.
4311
+ *
4312
+ * `ROUTES` is a low level API for router configuration via dependency injection.
4313
+ *
4314
+ * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4315
+ * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4316
+ *
4317
+ * @publicApi
4318
+ */
4319
+ const ROUTES = new InjectionToken('ROUTES');
4320
+ class RouterConfigLoader {
4321
+ constructor(injector, compiler) {
4322
+ this.injector = injector;
4323
+ this.compiler = compiler;
4324
+ this.componentLoaders = new WeakMap();
4325
+ this.childrenLoaders = new WeakMap();
4326
+ }
4327
+ loadComponent(route) {
4328
+ if (this.componentLoaders.get(route)) {
4329
+ return this.componentLoaders.get(route);
4330
+ }
4331
+ else if (route._loadedComponent) {
4332
+ return of(route._loadedComponent);
4333
+ }
4334
+ if (this.onLoadStartListener) {
4335
+ this.onLoadStartListener(route);
4336
+ }
4337
+ const loadRunner = wrapIntoObservable(route.loadComponent())
4338
+ .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4339
+ if (this.onLoadEndListener) {
4340
+ this.onLoadEndListener(route);
4341
+ }
4342
+ NG_DEV_MODE$5 && assertStandalone(route.path ?? '', component);
4343
+ route._loadedComponent = component;
4344
+ }), finalize(() => {
4345
+ this.componentLoaders.delete(route);
4346
+ }));
4347
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4348
+ const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4349
+ this.componentLoaders.set(route, loader);
4350
+ return loader;
4351
+ }
4352
+ loadChildren(parentInjector, route) {
4353
+ if (this.childrenLoaders.get(route)) {
4354
+ return this.childrenLoaders.get(route);
4355
+ }
4356
+ else if (route._loadedRoutes) {
4357
+ return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4358
+ }
4359
+ if (this.onLoadStartListener) {
4360
+ this.onLoadStartListener(route);
4361
+ }
4362
+ const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4363
+ const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4364
+ if (this.onLoadEndListener) {
4365
+ this.onLoadEndListener(route);
4366
+ }
4367
+ // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4368
+ // injector associated with lazy loading a `Route` array.
4369
+ let injector;
4370
+ let rawRoutes;
4371
+ let requireStandaloneComponents = false;
4372
+ if (Array.isArray(factoryOrRoutes)) {
4373
+ rawRoutes = factoryOrRoutes;
4374
+ requireStandaloneComponents = true;
4375
+ }
4376
+ else {
4377
+ injector = factoryOrRoutes.create(parentInjector).injector;
4378
+ // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4379
+ // will get stuck in an infinite loop. The child module's Injector will look to
4380
+ // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4381
+ // for it's parent module instead.
4382
+ rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4383
+ }
4384
+ const routes = rawRoutes.map(standardizeConfig);
4385
+ NG_DEV_MODE$5 && validateConfig(routes, route.path, requireStandaloneComponents);
4386
+ return { routes, injector };
4387
+ }), finalize(() => {
4388
+ this.childrenLoaders.delete(route);
4389
+ }));
4390
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4391
+ const loader = new ConnectableObservable(loadRunner, () => new Subject())
4392
+ .pipe(refCount());
4393
+ this.childrenLoaders.set(route, loader);
4394
+ return loader;
4395
+ }
4396
+ loadModuleFactoryOrRoutes(loadChildren) {
4397
+ const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4398
+ if (deprecatedResult) {
4399
+ return deprecatedResult;
4400
+ }
4401
+ return wrapIntoObservable(loadChildren())
4402
+ .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4403
+ if (t instanceof NgModuleFactory || Array.isArray(t)) {
4404
+ return of(t);
4405
+ }
4406
+ else {
4407
+ return from(this.compiler.compileModuleAsync(t));
4408
+ }
4409
+ }));
4410
+ }
4411
+ }
4412
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4413
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterConfigLoader, decorators: [{
4415
+ type: Injectable,
4416
+ args: [{ providedIn: 'root' }]
4417
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4418
+ function isWrappedDefaultExport(value) {
4419
+ // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4420
+ // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4421
+ // `default` will be a renamed property.
4422
+ return value && typeof value === 'object' && 'default' in value;
4423
+ }
4424
+ function maybeUnwrapDefaultExport(input) {
4425
+ // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4426
+ // subject to property renaming, so we reference it with bracket access.
4427
+ return isWrappedDefaultExport(input) ? input['default'] : input;
4428
+ }
4429
+
4430
+ /**
4431
+ * @license
4432
+ * Copyright Google LLC All Rights Reserved.
4433
+ *
4434
+ * Use of this source code is governed by an MIT-style license that can be
4435
+ * found in the LICENSE file at https://angular.io/license
4436
+ */
4437
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4296
4438
  class NavigationTransitions {
4297
- constructor(router) {
4298
- this.router = router;
4439
+ constructor() {
4299
4440
  this.currentNavigation = null;
4441
+ this.lastSuccessfulNavigation = null;
4442
+ this.events = new Subject();
4443
+ this.configLoader = inject(RouterConfigLoader);
4444
+ this.environmentInjector = inject(EnvironmentInjector);
4445
+ this.urlSerializer = inject(UrlSerializer);
4446
+ this.rootContexts = inject(ChildrenOutletContexts);
4447
+ this.navigationId = 0;
4448
+ const onLoadStart = (r) => this.events.next(new RouteConfigLoadStart(r));
4449
+ const onLoadEnd = (r) => this.events.next(new RouteConfigLoadEnd(r));
4450
+ this.configLoader.onLoadEndListener = onLoadEnd;
4451
+ this.configLoader.onLoadStartListener = onLoadStart;
4452
+ }
4453
+ get hasRequestedNavigation() {
4454
+ return this.navigationId !== 0;
4455
+ }
4456
+ complete() {
4457
+ this.transitions?.complete();
4458
+ }
4459
+ handleNavigationRequest(request) {
4460
+ const id = ++this.navigationId;
4461
+ this.transitions?.next({ ...this.transitions.value, ...request, id });
4300
4462
  }
4301
- setupNavigations(transitions) {
4302
- const eventsSubject = this.router.events;
4303
- return transitions.pipe(filter(t => t.id !== 0),
4463
+ setupNavigations(router) {
4464
+ this.transitions = new BehaviorSubject({
4465
+ id: 0,
4466
+ targetPageId: 0,
4467
+ currentUrlTree: router.currentUrlTree,
4468
+ currentRawUrl: router.currentUrlTree,
4469
+ extractedUrl: router.urlHandlingStrategy.extract(router.currentUrlTree),
4470
+ urlAfterRedirects: router.urlHandlingStrategy.extract(router.currentUrlTree),
4471
+ rawUrl: router.currentUrlTree,
4472
+ extras: {},
4473
+ resolve: null,
4474
+ reject: null,
4475
+ promise: Promise.resolve(true),
4476
+ source: 'imperative',
4477
+ restoredState: null,
4478
+ currentSnapshot: router.routerState.snapshot,
4479
+ targetSnapshot: null,
4480
+ currentRouterState: router.routerState,
4481
+ targetRouterState: null,
4482
+ guards: { canActivateChecks: [], canDeactivateChecks: [] },
4483
+ guardsResult: null,
4484
+ });
4485
+ return this.transitions.pipe(filter(t => t.id !== 0),
4304
4486
  // Extract URL
4305
- map(t => ({ ...t, extractedUrl: this.router.urlHandlingStrategy.extract(t.rawUrl) })),
4487
+ map(t => ({ ...t, extractedUrl: router.urlHandlingStrategy.extract(t.rawUrl) })),
4306
4488
  // Using switchMap so we cancel executing navigations when a new one comes in
4307
4489
  switchMap(overallTransitionState => {
4308
4490
  let completed = false;
@@ -4317,35 +4499,34 @@ class NavigationTransitions {
4317
4499
  extractedUrl: t.extractedUrl,
4318
4500
  trigger: t.source,
4319
4501
  extras: t.extras,
4320
- previousNavigation: !this.router.lastSuccessfulNavigation ? null : {
4321
- ...this.router.lastSuccessfulNavigation,
4502
+ previousNavigation: !this.lastSuccessfulNavigation ? null : {
4503
+ ...this.lastSuccessfulNavigation,
4322
4504
  previousNavigation: null,
4323
4505
  },
4324
4506
  };
4325
4507
  }), switchMap(t => {
4326
- const browserUrlTree = this.router.browserUrlTree.toString();
4327
- const urlTransition = !this.router.navigated ||
4508
+ const browserUrlTree = router.browserUrlTree.toString();
4509
+ const urlTransition = !router.navigated ||
4328
4510
  t.extractedUrl.toString() !== browserUrlTree ||
4329
4511
  // Navigations which succeed or ones which fail and are cleaned up
4330
4512
  // correctly should result in `browserUrlTree` and `currentUrlTree`
4331
4513
  // matching. If this is not the case, assume something went wrong and
4332
4514
  // try processing the URL again.
4333
- browserUrlTree !== this.router.currentUrlTree.toString();
4334
- const processCurrentUrl = (this.router.onSameUrlNavigation === 'reload' ? true :
4335
- urlTransition) &&
4336
- this.router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4515
+ browserUrlTree !== router.currentUrlTree.toString();
4516
+ const processCurrentUrl = (router.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4517
+ router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4337
4518
  if (processCurrentUrl) {
4338
4519
  // If the source of the navigation is from a browser event, the URL is
4339
4520
  // already updated. We already need to sync the internal state.
4340
4521
  if (isBrowserTriggeredNavigation(t.source)) {
4341
- this.router.browserUrlTree = t.extractedUrl;
4522
+ router.browserUrlTree = t.extractedUrl;
4342
4523
  }
4343
4524
  return of(t).pipe(
4344
4525
  // Fire NavigationStart event
4345
4526
  switchMap(t => {
4346
- const transition = this.router.transitions.getValue();
4347
- eventsSubject.next(new NavigationStart(t.id, this.router.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4348
- if (transition !== this.router.transitions.getValue()) {
4527
+ const transition = this.transitions?.getValue();
4528
+ this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));
4529
+ if (transition !== this.transitions?.getValue()) {
4349
4530
  return EMPTY;
4350
4531
  }
4351
4532
  // This delay is required to match old behavior that forced
@@ -4353,7 +4534,7 @@ class NavigationTransitions {
4353
4534
  return Promise.resolve(t);
4354
4535
  }),
4355
4536
  // ApplyRedirects
4356
- applyRedirects(this.router.ngModule.injector, this.router.configLoader, this.router.urlSerializer, this.router.config),
4537
+ applyRedirects(this.environmentInjector, this.configLoader, this.urlSerializer, router.config),
4357
4538
  // Update the currentNavigation
4358
4539
  // `urlAfterRedirects` is guaranteed to be set after this point
4359
4540
  tap(t => {
@@ -4364,33 +4545,33 @@ class NavigationTransitions {
4364
4545
  overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4365
4546
  }),
4366
4547
  // Recognize
4367
- recognize(this.router.ngModule.injector, this.router.rootComponentType, this.router.config, this.router.urlSerializer, this.router.paramsInheritanceStrategy),
4548
+ recognize(this.environmentInjector, router.rootComponentType, router.config, this.urlSerializer, router.paramsInheritanceStrategy),
4368
4549
  // Update URL if in `eager` update mode
4369
4550
  tap(t => {
4370
4551
  overallTransitionState.targetSnapshot = t.targetSnapshot;
4371
- if (this.router.urlUpdateStrategy === 'eager') {
4552
+ if (router.urlUpdateStrategy === 'eager') {
4372
4553
  if (!t.extras.skipLocationChange) {
4373
- const rawUrl = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4374
- this.router.setBrowserUrl(rawUrl, t);
4554
+ const rawUrl = router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4555
+ router.setBrowserUrl(rawUrl, t);
4375
4556
  }
4376
- this.router.browserUrlTree = t.urlAfterRedirects;
4557
+ router.browserUrlTree = t.urlAfterRedirects;
4377
4558
  }
4378
4559
  // Fire RoutesRecognized
4379
- const routesRecognized = new RoutesRecognized(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4380
- eventsSubject.next(routesRecognized);
4560
+ const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4561
+ this.events.next(routesRecognized);
4381
4562
  }));
4382
4563
  }
4383
4564
  else {
4384
- const processPreviousUrl = urlTransition && this.router.rawUrlTree &&
4385
- this.router.urlHandlingStrategy.shouldProcessUrl(this.router.rawUrlTree);
4565
+ const processPreviousUrl = urlTransition && router.rawUrlTree &&
4566
+ router.urlHandlingStrategy.shouldProcessUrl(router.rawUrlTree);
4386
4567
  /* When the current URL shouldn't be processed, but the previous one
4387
4568
  * was, we handle this "error condition" by navigating to the
4388
4569
  * previously successful URL, but leaving the URL intact.*/
4389
4570
  if (processPreviousUrl) {
4390
4571
  const { id, extractedUrl, source, restoredState, extras } = t;
4391
- const navStart = new NavigationStart(id, this.router.serializeUrl(extractedUrl), source, restoredState);
4392
- eventsSubject.next(navStart);
4393
- const targetSnapshot = createEmptyState(extractedUrl, this.router.rootComponentType)
4572
+ const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
4573
+ this.events.next(navStart);
4574
+ const targetSnapshot = createEmptyState(extractedUrl, router.rootComponentType)
4394
4575
  .snapshot;
4395
4576
  overallTransitionState = {
4396
4577
  ...t,
@@ -4406,7 +4587,7 @@ class NavigationTransitions {
4406
4587
  * current "settled" URL. This way the next navigation will be coming
4407
4588
  * from the current URL in the browser.
4408
4589
  */
4409
- this.router.rawUrlTree = t.rawUrl;
4590
+ router.rawUrlTree = t.rawUrl;
4410
4591
  t.resolve(null);
4411
4592
  return EMPTY;
4412
4593
  }
@@ -4414,25 +4595,25 @@ class NavigationTransitions {
4414
4595
  }),
4415
4596
  // --- GUARDS ---
4416
4597
  tap(t => {
4417
- const guardsStart = new GuardsCheckStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4418
- this.router.triggerEvent(guardsStart);
4598
+ const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4599
+ this.events.next(guardsStart);
4419
4600
  }), map(t => {
4420
4601
  overallTransitionState = {
4421
4602
  ...t,
4422
- guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.router.rootContexts)
4603
+ guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4423
4604
  };
4424
4605
  return overallTransitionState;
4425
- }), checkGuards(this.router.ngModule.injector, (evt) => this.router.triggerEvent(evt)), tap(t => {
4606
+ }), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap(t => {
4426
4607
  overallTransitionState.guardsResult = t.guardsResult;
4427
4608
  if (isUrlTree(t.guardsResult)) {
4428
- throw redirectingNavigationError(this.router.urlSerializer, t.guardsResult);
4609
+ throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4429
4610
  }
4430
- const guardsEnd = new GuardsCheckEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4431
- this.router.triggerEvent(guardsEnd);
4611
+ const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4612
+ this.events.next(guardsEnd);
4432
4613
  }), filter(t => {
4433
4614
  if (!t.guardsResult) {
4434
- this.router.restoreHistory(t);
4435
- this.router.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4615
+ router.restoreHistory(t);
4616
+ this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */, router);
4436
4617
  return false;
4437
4618
  }
4438
4619
  return true;
@@ -4441,24 +4622,24 @@ class NavigationTransitions {
4441
4622
  switchTap(t => {
4442
4623
  if (t.guards.canActivateChecks.length) {
4443
4624
  return of(t).pipe(tap(t => {
4444
- const resolveStart = new ResolveStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4445
- this.router.triggerEvent(resolveStart);
4625
+ const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4626
+ this.events.next(resolveStart);
4446
4627
  }), switchMap(t => {
4447
4628
  let dataResolved = false;
4448
- return of(t).pipe(resolveData(this.router.paramsInheritanceStrategy, this.router.ngModule.injector), tap({
4629
+ return of(t).pipe(resolveData(router.paramsInheritanceStrategy, this.environmentInjector), tap({
4449
4630
  next: () => dataResolved = true,
4450
4631
  complete: () => {
4451
4632
  if (!dataResolved) {
4452
- this.router.restoreHistory(t);
4453
- this.router.cancelNavigationTransition(t, NG_DEV_MODE$5 ?
4633
+ router.restoreHistory(t);
4634
+ this.cancelNavigationTransition(t, NG_DEV_MODE$4 ?
4454
4635
  `At least one route resolver didn't emit any value.` :
4455
- '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4636
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */, router);
4456
4637
  }
4457
4638
  }
4458
4639
  }));
4459
4640
  }), tap(t => {
4460
- const resolveEnd = new ResolveEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4461
- this.router.triggerEvent(resolveEnd);
4641
+ const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4642
+ this.events.next(resolveEnd);
4462
4643
  }));
4463
4644
  }
4464
4645
  return undefined;
@@ -4469,7 +4650,7 @@ class NavigationTransitions {
4469
4650
  const loaders = [];
4470
4651
  if (route.routeConfig?.loadComponent &&
4471
4652
  !route.routeConfig._loadedComponent) {
4472
- loaders.push(this.router.configLoader.loadComponent(route.routeConfig)
4653
+ loaders.push(this.configLoader.loadComponent(route.routeConfig)
4473
4654
  .pipe(tap(loadedComponent => {
4474
4655
  route.component = loadedComponent;
4475
4656
  }), map(() => void 0)));
@@ -4481,8 +4662,8 @@ class NavigationTransitions {
4481
4662
  };
4482
4663
  return combineLatest(loadComponents(t.targetSnapshot.root))
4483
4664
  .pipe(defaultIfEmpty(), take(1));
4484
- }), switchTap(() => this.router.afterPreactivation()), map((t) => {
4485
- const targetRouterState = createRouterState(this.router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4665
+ }), switchTap(() => router.afterPreactivation()), map((t) => {
4666
+ const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4486
4667
  overallTransitionState = { ...t, targetRouterState };
4487
4668
  return (overallTransitionState);
4488
4669
  }),
@@ -4492,21 +4673,27 @@ class NavigationTransitions {
4492
4673
  the current URL and the RouterState, as well as updated the browser URL.
4493
4674
  All this should happen *before* activating. */
4494
4675
  tap((t) => {
4495
- this.router.currentUrlTree = t.urlAfterRedirects;
4496
- this.router.rawUrlTree = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4497
- this.router.routerState =
4676
+ router.currentUrlTree = t.urlAfterRedirects;
4677
+ router.rawUrlTree =
4678
+ router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4679
+ router.routerState =
4498
4680
  t.targetRouterState;
4499
- if (this.router.urlUpdateStrategy === 'deferred') {
4681
+ if (router.urlUpdateStrategy === 'deferred') {
4500
4682
  if (!t.extras.skipLocationChange) {
4501
- this.router.setBrowserUrl(this.router.rawUrlTree, t);
4683
+ router.setBrowserUrl(router.rawUrlTree, t);
4502
4684
  }
4503
- this.router.browserUrlTree = t.urlAfterRedirects;
4685
+ router.browserUrlTree = t.urlAfterRedirects;
4504
4686
  }
4505
- }), activateRoutes(this.router.rootContexts, this.router.routeReuseStrategy, (evt) => this.router.triggerEvent(evt)), tap({
4506
- next() {
4687
+ }), activateRoutes(this.rootContexts, router.routeReuseStrategy, (evt) => this.events.next(evt)), tap({
4688
+ next: (t) => {
4507
4689
  completed = true;
4690
+ this.lastSuccessfulNavigation = this.currentNavigation;
4691
+ router.navigated = true;
4692
+ this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(router.currentUrlTree)));
4693
+ router.titleStrategy?.updateTitle(t.targetRouterState.snapshot);
4694
+ t.resolve(true);
4508
4695
  },
4509
- complete() {
4696
+ complete: () => {
4510
4697
  completed = true;
4511
4698
  }
4512
4699
  }), finalize(() => {
@@ -4517,11 +4704,11 @@ class NavigationTransitions {
4517
4704
  * catch-all to make sure the NavigationCancel event is fired when a
4518
4705
  * navigation gets cancelled but not caught by other means. */
4519
4706
  if (!completed && !errored) {
4520
- const cancelationReason = NG_DEV_MODE$5 ?
4707
+ const cancelationReason = NG_DEV_MODE$4 ?
4521
4708
  `Navigation ID ${overallTransitionState
4522
- .id} is not equal to the current navigation id ${this.router.navigationId}` :
4709
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4523
4710
  '';
4524
- this.router.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4711
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */, router);
4525
4712
  }
4526
4713
  // Only clear current navigation if it is still set to the one that
4527
4714
  // finalized.
@@ -4540,28 +4727,28 @@ class NavigationTransitions {
4540
4727
  // navigate. This is only applicable with initial navigation, so
4541
4728
  // setting `navigated` only when not redirecting resolves this
4542
4729
  // scenario.
4543
- this.router.navigated = true;
4544
- this.router.restoreHistory(overallTransitionState, true);
4730
+ router.navigated = true;
4731
+ router.restoreHistory(overallTransitionState, true);
4545
4732
  }
4546
- const navCancel = new NavigationCancel(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4547
- eventsSubject.next(navCancel);
4733
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4734
+ this.events.next(navCancel);
4548
4735
  // When redirecting, we need to delay resolving the navigation
4549
4736
  // promise and push it to the redirect navigation
4550
4737
  if (!isRedirectingNavigationCancelingError$1(e)) {
4551
4738
  overallTransitionState.resolve(false);
4552
4739
  }
4553
4740
  else {
4554
- const mergedTree = this.router.urlHandlingStrategy.merge(e.url, this.router.rawUrlTree);
4741
+ const mergedTree = router.urlHandlingStrategy.merge(e.url, router.rawUrlTree);
4555
4742
  const extras = {
4556
4743
  skipLocationChange: overallTransitionState.extras.skipLocationChange,
4557
4744
  // The URL is already updated at this point if we have 'eager' URL
4558
4745
  // updates or if the navigation was triggered by the browser (back
4559
4746
  // button, URL bar, etc). We want to replace that item in history
4560
4747
  // if the navigation is rejected.
4561
- replaceUrl: this.router.urlUpdateStrategy === 'eager' ||
4748
+ replaceUrl: router.urlUpdateStrategy === 'eager' ||
4562
4749
  isBrowserTriggeredNavigation(overallTransitionState.source)
4563
4750
  };
4564
- this.router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4751
+ router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4565
4752
  resolve: overallTransitionState.resolve,
4566
4753
  reject: overallTransitionState.reject,
4567
4754
  promise: overallTransitionState.promise
@@ -4571,11 +4758,11 @@ class NavigationTransitions {
4571
4758
  * to the pre-error state. */
4572
4759
  }
4573
4760
  else {
4574
- this.router.restoreHistory(overallTransitionState, true);
4575
- const navError = new NavigationError(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
4576
- eventsSubject.next(navError);
4761
+ router.restoreHistory(overallTransitionState, true);
4762
+ const navError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
4763
+ this.events.next(navError);
4577
4764
  try {
4578
- overallTransitionState.resolve(this.router.errorHandler(e));
4765
+ overallTransitionState.resolve(router.errorHandler(e));
4579
4766
  }
4580
4767
  catch (ee) {
4581
4768
  overallTransitionState.reject(ee);
@@ -4586,7 +4773,18 @@ class NavigationTransitions {
4586
4773
  // TODO(jasonaden): remove cast once g3 is on updated TypeScript
4587
4774
  }));
4588
4775
  }
4776
+ cancelNavigationTransition(t, reason, code, router) {
4777
+ const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);
4778
+ this.events.next(navCancel);
4779
+ t.resolve(false);
4780
+ }
4589
4781
  }
4782
+ NavigationTransitions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4783
+ NavigationTransitions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NavigationTransitions, providedIn: 'root' });
4784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NavigationTransitions, decorators: [{
4785
+ type: Injectable,
4786
+ args: [{ providedIn: 'root' }]
4787
+ }], ctorParameters: function () { return []; } });
4590
4788
  function isBrowserTriggeredNavigation(source) {
4591
4789
  return source !== 'imperative';
4592
4790
  }
@@ -4642,9 +4840,9 @@ class TitleStrategy {
4642
4840
  return snapshot.data[RouteTitleKey];
4643
4841
  }
4644
4842
  }
4645
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4646
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, decorators: [{
4843
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4844
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TitleStrategy, decorators: [{
4648
4846
  type: Injectable,
4649
4847
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4650
4848
  }] });
@@ -4668,9 +4866,9 @@ class DefaultTitleStrategy extends TitleStrategy {
4668
4866
  }
4669
4867
  }
4670
4868
  }
4671
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4672
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4869
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4870
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4871
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4674
4872
  type: Injectable,
4675
4873
  args: [{ providedIn: 'root' }]
4676
4874
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -4691,9 +4889,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4691
4889
  */
4692
4890
  class RouteReuseStrategy {
4693
4891
  }
4694
- RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4695
- RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4696
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4892
+ RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4893
+ RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4894
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4697
4895
  type: Injectable,
4698
4896
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4699
4897
  }] });
@@ -4745,9 +4943,9 @@ class BaseRouteReuseStrategy {
4745
4943
  }
4746
4944
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4747
4945
  }
4748
- DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4749
- DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4946
+ DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4947
+ DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4948
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4751
4949
  type: Injectable,
4752
4950
  args: [{ providedIn: 'root' }]
4753
4951
  }] });
@@ -4759,157 +4957,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4759
4957
  * Use of this source code is governed by an MIT-style license that can be
4760
4958
  * found in the LICENSE file at https://angular.io/license
4761
4959
  */
4762
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4960
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4763
4961
  /**
4764
4962
  * A [DI token](guide/glossary/#di-token) for the router service.
4765
4963
  *
4766
4964
  * @publicApi
4767
4965
  */
4768
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
4966
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4769
4967
  providedIn: 'root',
4770
4968
  factory: () => ({}),
4771
4969
  });
4772
4970
 
4773
- /**
4774
- * @license
4775
- * Copyright Google LLC All Rights Reserved.
4776
- *
4777
- * Use of this source code is governed by an MIT-style license that can be
4778
- * found in the LICENSE file at https://angular.io/license
4779
- */
4780
- function deprecatedLoadChildrenString(injector, loadChildren) {
4781
- return null;
4782
- }
4783
-
4784
- /**
4785
- * @license
4786
- * Copyright Google LLC All Rights Reserved.
4787
- *
4788
- * Use of this source code is governed by an MIT-style license that can be
4789
- * found in the LICENSE file at https://angular.io/license
4790
- */
4791
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4792
- /**
4793
- * The [DI token](guide/glossary/#di-token) for a router configuration.
4794
- *
4795
- * `ROUTES` is a low level API for router configuration via dependency injection.
4796
- *
4797
- * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4798
- * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4799
- *
4800
- * @publicApi
4801
- */
4802
- const ROUTES = new InjectionToken('ROUTES');
4803
- class RouterConfigLoader {
4804
- constructor(injector, compiler) {
4805
- this.injector = injector;
4806
- this.compiler = compiler;
4807
- this.componentLoaders = new WeakMap();
4808
- this.childrenLoaders = new WeakMap();
4809
- }
4810
- loadComponent(route) {
4811
- if (this.componentLoaders.get(route)) {
4812
- return this.componentLoaders.get(route);
4813
- }
4814
- else if (route._loadedComponent) {
4815
- return of(route._loadedComponent);
4816
- }
4817
- if (this.onLoadStartListener) {
4818
- this.onLoadStartListener(route);
4819
- }
4820
- const loadRunner = wrapIntoObservable(route.loadComponent())
4821
- .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4822
- if (this.onLoadEndListener) {
4823
- this.onLoadEndListener(route);
4824
- }
4825
- NG_DEV_MODE$3 && assertStandalone(route.path ?? '', component);
4826
- route._loadedComponent = component;
4827
- }), finalize(() => {
4828
- this.componentLoaders.delete(route);
4829
- }));
4830
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4831
- const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4832
- this.componentLoaders.set(route, loader);
4833
- return loader;
4834
- }
4835
- loadChildren(parentInjector, route) {
4836
- if (this.childrenLoaders.get(route)) {
4837
- return this.childrenLoaders.get(route);
4838
- }
4839
- else if (route._loadedRoutes) {
4840
- return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4841
- }
4842
- if (this.onLoadStartListener) {
4843
- this.onLoadStartListener(route);
4844
- }
4845
- const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4846
- const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4847
- if (this.onLoadEndListener) {
4848
- this.onLoadEndListener(route);
4849
- }
4850
- // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4851
- // injector associated with lazy loading a `Route` array.
4852
- let injector;
4853
- let rawRoutes;
4854
- let requireStandaloneComponents = false;
4855
- if (Array.isArray(factoryOrRoutes)) {
4856
- rawRoutes = factoryOrRoutes;
4857
- requireStandaloneComponents = true;
4858
- }
4859
- else {
4860
- injector = factoryOrRoutes.create(parentInjector).injector;
4861
- // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4862
- // will get stuck in an infinite loop. The child module's Injector will look to
4863
- // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4864
- // for it's parent module instead.
4865
- rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4866
- }
4867
- const routes = rawRoutes.map(standardizeConfig);
4868
- NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
4869
- return { routes, injector };
4870
- }), finalize(() => {
4871
- this.childrenLoaders.delete(route);
4872
- }));
4873
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4874
- const loader = new ConnectableObservable(loadRunner, () => new Subject())
4875
- .pipe(refCount());
4876
- this.childrenLoaders.set(route, loader);
4877
- return loader;
4878
- }
4879
- loadModuleFactoryOrRoutes(loadChildren) {
4880
- const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4881
- if (deprecatedResult) {
4882
- return deprecatedResult;
4883
- }
4884
- return wrapIntoObservable(loadChildren())
4885
- .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4886
- if (t instanceof NgModuleFactory || Array.isArray(t)) {
4887
- return of(t);
4888
- }
4889
- else {
4890
- return from(this.compiler.compileModuleAsync(t));
4891
- }
4892
- }));
4893
- }
4894
- }
4895
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4896
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4897
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4898
- type: Injectable,
4899
- args: [{ providedIn: 'root' }]
4900
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4901
- function isWrappedDefaultExport(value) {
4902
- // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4903
- // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4904
- // `default` will be a renamed property.
4905
- return value && typeof value === 'object' && 'default' in value;
4906
- }
4907
- function maybeUnwrapDefaultExport(input) {
4908
- // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4909
- // subject to property renaming, so we reference it with bracket access.
4910
- return isWrappedDefaultExport(input) ? input['default'] : input;
4911
- }
4912
-
4913
4971
  /**
4914
4972
  * @license
4915
4973
  * Copyright Google LLC All Rights Reserved.
@@ -4926,9 +4984,9 @@ function maybeUnwrapDefaultExport(input) {
4926
4984
  */
4927
4985
  class UrlHandlingStrategy {
4928
4986
  }
4929
- UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4930
- UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4987
+ UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4988
+ UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4989
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4932
4990
  type: Injectable,
4933
4991
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4934
4992
  }] });
@@ -4946,9 +5004,9 @@ class DefaultUrlHandlingStrategy {
4946
5004
  return newUrlPart;
4947
5005
  }
4948
5006
  }
4949
- DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4950
- DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
4951
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
5007
+ DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5008
+ DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
5009
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4952
5010
  type: Injectable,
4953
5011
  args: [{ providedIn: 'root' }]
4954
5012
  }] });
@@ -4987,38 +5045,6 @@ const subsetMatchOptions = {
4987
5045
  matrixParams: 'ignored',
4988
5046
  queryParams: 'subset'
4989
5047
  };
4990
- function assignExtraOptionsToRouter(opts, router) {
4991
- if (opts.errorHandler) {
4992
- router.errorHandler = opts.errorHandler;
4993
- }
4994
- if (opts.malformedUriErrorHandler) {
4995
- router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
4996
- }
4997
- if (opts.onSameUrlNavigation) {
4998
- router.onSameUrlNavigation = opts.onSameUrlNavigation;
4999
- }
5000
- if (opts.paramsInheritanceStrategy) {
5001
- router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
5002
- }
5003
- if (opts.urlUpdateStrategy) {
5004
- router.urlUpdateStrategy = opts.urlUpdateStrategy;
5005
- }
5006
- if (opts.canceledNavigationResolution) {
5007
- router.canceledNavigationResolution = opts.canceledNavigationResolution;
5008
- }
5009
- }
5010
- function setupRouter() {
5011
- const urlSerializer = inject(UrlSerializer);
5012
- const contexts = inject(ChildrenOutletContexts);
5013
- const location = inject(Location);
5014
- const injector = inject(Injector);
5015
- const compiler = inject(Compiler);
5016
- const config = inject(ROUTES, { optional: true }) ?? [];
5017
- const opts = inject(ROUTER_CONFIGURATION, { optional: true }) ?? {};
5018
- const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
5019
- assignExtraOptionsToRouter(opts, router);
5020
- return router;
5021
- }
5022
5048
  /**
5023
5049
  * @description
5024
5050
  *
@@ -5032,29 +5058,8 @@ function setupRouter() {
5032
5058
  * @publicApi
5033
5059
  */
5034
5060
  class Router {
5035
- /**
5036
- * Creates the router service.
5037
- */
5038
- // TODO: vsavkin make internal after the final is out.
5039
- constructor(
5040
- /** @internal */
5041
- rootComponentType,
5042
- /** @internal */
5043
- urlSerializer,
5044
- /** @internal */
5045
- rootContexts,
5046
- /** @internal */
5047
- location, injector, compiler, config) {
5048
- this.rootComponentType = rootComponentType;
5049
- this.urlSerializer = urlSerializer;
5050
- this.rootContexts = rootContexts;
5051
- this.location = location;
5052
- this.config = config;
5053
- /** @internal */
5054
- this.lastSuccessfulNavigation = null;
5061
+ constructor() {
5055
5062
  this.disposed = false;
5056
- /** @internal */
5057
- this.navigationId = 0;
5058
5063
  /**
5059
5064
  * The id of the currently active page in the router.
5060
5065
  * Updated to the transition's target id on a successful navigation.
@@ -5064,22 +5069,20 @@ class Router {
5064
5069
  * page.
5065
5070
  */
5066
5071
  this.currentPageId = 0;
5072
+ this.console = inject(ɵConsole);
5067
5073
  this.isNgZoneEnabled = false;
5068
- /**
5069
- * An event stream for routing events in this NgModule.
5070
- */
5071
- this.events = new Subject();
5074
+ this.options = inject(ROUTER_CONFIGURATION, { optional: true }) || {};
5072
5075
  /**
5073
5076
  * A handler for navigation errors in this NgModule.
5074
5077
  */
5075
- this.errorHandler = defaultErrorHandler;
5078
+ this.errorHandler = this.options.errorHandler || defaultErrorHandler;
5076
5079
  /**
5077
5080
  * A handler for errors thrown by `Router.parseUrl(url)`
5078
5081
  * when `url` contains an invalid character.
5079
5082
  * The most common case is a `%` sign
5080
5083
  * that's not encoded and is not part of a percent encoded sequence.
5081
5084
  */
5082
- this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
5085
+ this.malformedUriErrorHandler = this.options.malformedUriErrorHandler || defaultMalformedUriErrorHandler;
5083
5086
  /**
5084
5087
  * True if at least one navigation event has occurred,
5085
5088
  * false otherwise.
@@ -5119,7 +5122,7 @@ class Router {
5119
5122
  * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
5120
5123
  * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
5121
5124
  */
5122
- this.onSameUrlNavigation = 'ignore';
5125
+ this.onSameUrlNavigation = this.options.onSameUrlNavigation || 'ignore';
5123
5126
  /**
5124
5127
  * How to merge parameters, data, resolved data, and title from parent to child
5125
5128
  * routes. One of:
@@ -5129,7 +5132,7 @@ class Router {
5129
5132
  * - `'always'` : Inherit parent parameters, data, and resolved data
5130
5133
  * for all child routes.
5131
5134
  */
5132
- this.paramsInheritanceStrategy = 'emptyOnly';
5135
+ this.paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || 'emptyOnly';
5133
5136
  /**
5134
5137
  * Determines when the router updates the browser URL.
5135
5138
  * By default (`"deferred"`), updates the browser URL after navigation has finished.
@@ -5137,7 +5140,7 @@ class Router {
5137
5140
  * You can choose to update early so that, if navigation fails,
5138
5141
  * you can show an error message with the URL that failed.
5139
5142
  */
5140
- this.urlUpdateStrategy = 'deferred';
5143
+ this.urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';
5141
5144
  /**
5142
5145
  * Configures how the Router attempts to restore state when a navigation is cancelled.
5143
5146
  *
@@ -5160,44 +5163,30 @@ class Router {
5160
5163
  * The default value is `replace`.
5161
5164
  *
5162
5165
  */
5163
- this.canceledNavigationResolution = 'replace';
5164
- this.navigationTransitions = new NavigationTransitions(this);
5165
- const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r));
5166
- const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r));
5167
- this.configLoader = injector.get(RouterConfigLoader);
5168
- this.configLoader.onLoadEndListener = onLoadEnd;
5169
- this.configLoader.onLoadStartListener = onLoadStart;
5170
- this.ngModule = injector.get(NgModuleRef);
5171
- this.console = injector.get(ɵConsole);
5172
- const ngZone = injector.get(NgZone);
5173
- this.isNgZoneEnabled = ngZone instanceof NgZone && NgZone.isInAngularZone();
5174
- this.resetConfig(config);
5166
+ this.canceledNavigationResolution = this.options.canceledNavigationResolution || 'replace';
5167
+ this.config = flatten(inject(ROUTES, { optional: true }) ?? []);
5168
+ this.navigationTransitions = inject(NavigationTransitions);
5169
+ this.urlSerializer = inject(UrlSerializer);
5170
+ this.location = inject(Location);
5171
+ /** @internal */
5172
+ this.rootComponentType = null;
5173
+ this.isNgZoneEnabled = inject(NgZone) instanceof NgZone && NgZone.isInAngularZone();
5174
+ this.resetConfig(this.config);
5175
5175
  this.currentUrlTree = new UrlTree();
5176
5176
  this.rawUrlTree = this.currentUrlTree;
5177
5177
  this.browserUrlTree = this.currentUrlTree;
5178
5178
  this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
5179
- this.transitions = new BehaviorSubject({
5180
- id: 0,
5181
- targetPageId: 0,
5182
- currentUrlTree: this.currentUrlTree,
5183
- extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
5184
- urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
5185
- rawUrl: this.currentUrlTree,
5186
- extras: {},
5187
- resolve: null,
5188
- reject: null,
5189
- promise: Promise.resolve(true),
5190
- source: 'imperative',
5191
- restoredState: null,
5192
- currentSnapshot: this.routerState.snapshot,
5193
- targetSnapshot: null,
5194
- currentRouterState: this.routerState,
5195
- targetRouterState: null,
5196
- guards: { canActivateChecks: [], canDeactivateChecks: [] },
5197
- guardsResult: null,
5179
+ this.navigationTransitions.setupNavigations(this).subscribe(t => {
5180
+ this.lastSuccessfulId = t.id;
5181
+ this.currentPageId = t.targetPageId;
5182
+ }, e => {
5183
+ this.console.warn(`Unhandled Navigation Error: ${e}`);
5198
5184
  });
5199
- this.navigations = this.navigationTransitions.setupNavigations(this.transitions);
5200
- this.processNavigations();
5185
+ }
5186
+ // TODO(b/260747083): This should not exist and navigationId should be private in
5187
+ // `NavigationTransitions`
5188
+ get navigationId() {
5189
+ return this.navigationTransitions.navigationId;
5201
5190
  }
5202
5191
  /**
5203
5192
  * The ɵrouterPageId of whatever page is currently active in the browser history. This is
@@ -5208,24 +5197,28 @@ class Router {
5208
5197
  return this.location.getState()?.ɵrouterPageId;
5209
5198
  }
5210
5199
  /**
5211
- * @internal
5212
- * TODO: this should be removed once the constructor of the router made internal
5200
+ * An event stream for routing events.
5213
5201
  */
5202
+ get events() {
5203
+ // TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal
5204
+ // cleanup: tests are doing `(route.events as Subject<Event>).next(...)`. This isn't
5205
+ // allowed/supported but we still have to fix these or file bugs against the teams before making
5206
+ // the change.
5207
+ return this.navigationTransitions.events;
5208
+ }
5209
+ /** @internal */
5214
5210
  resetRootComponentType(rootComponentType) {
5215
5211
  this.rootComponentType = rootComponentType;
5216
5212
  // TODO: vsavkin router 4.0 should make the root component set to null
5217
5213
  // this will simplify the lifecycle of the router.
5218
5214
  this.routerState.root.component = this.rootComponentType;
5219
5215
  }
5220
- setTransition(t) {
5221
- this.transitions.next({ ...this.transitions.value, ...t });
5222
- }
5223
5216
  /**
5224
5217
  * Sets up the location change listener and performs the initial navigation.
5225
5218
  */
5226
5219
  initialNavigation() {
5227
5220
  this.setUpLocationChangeListener();
5228
- if (this.navigationId === 0) {
5221
+ if (!this.navigationTransitions.hasRequestedNavigation) {
5229
5222
  this.navigateByUrl(this.location.path(true), { replaceUrl: true });
5230
5223
  }
5231
5224
  }
@@ -5282,10 +5275,6 @@ class Router {
5282
5275
  getCurrentNavigation() {
5283
5276
  return this.navigationTransitions.currentNavigation;
5284
5277
  }
5285
- /** @internal */
5286
- triggerEvent(event) {
5287
- this.events.next(event);
5288
- }
5289
5278
  /**
5290
5279
  * Resets the route configuration used for navigation and generating links.
5291
5280
  *
@@ -5314,7 +5303,7 @@ class Router {
5314
5303
  }
5315
5304
  /** Disposes of the router. */
5316
5305
  dispose() {
5317
- this.transitions.complete();
5306
+ this.navigationTransitions.complete();
5318
5307
  if (this.locationSubscription) {
5319
5308
  this.locationSubscription.unsubscribe();
5320
5309
  this.locationSubscription = undefined;
@@ -5499,20 +5488,6 @@ class Router {
5499
5488
  return result;
5500
5489
  }, {});
5501
5490
  }
5502
- processNavigations() {
5503
- this.navigations.subscribe(t => {
5504
- this.navigated = true;
5505
- this.lastSuccessfulId = t.id;
5506
- this.currentPageId = t.targetPageId;
5507
- this.events
5508
- .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
5509
- this.lastSuccessfulNavigation = this.getCurrentNavigation();
5510
- this.titleStrategy?.updateTitle(this.routerState.snapshot);
5511
- t.resolve(true);
5512
- }, e => {
5513
- this.console.warn(`Unhandled Navigation Error: ${e}`);
5514
- });
5515
- }
5516
5491
  /** @internal */
5517
5492
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
5518
5493
  if (this.disposed) {
@@ -5532,7 +5507,6 @@ class Router {
5532
5507
  reject = rej;
5533
5508
  });
5534
5509
  }
5535
- const id = ++this.navigationId;
5536
5510
  let targetPageId;
5537
5511
  if (this.canceledNavigationResolution === 'computed') {
5538
5512
  const isInitialPage = this.currentPageId === 0;
@@ -5560,12 +5534,12 @@ class Router {
5560
5534
  // This is unused when `canceledNavigationResolution` is not computed.
5561
5535
  targetPageId = 0;
5562
5536
  }
5563
- this.setTransition({
5564
- id,
5537
+ this.navigationTransitions.handleNavigationRequest({
5565
5538
  targetPageId,
5566
5539
  source,
5567
5540
  restoredState,
5568
5541
  currentUrlTree: this.currentUrlTree,
5542
+ currentRawUrl: this.currentUrlTree,
5569
5543
  rawUrl,
5570
5544
  extras,
5571
5545
  resolve,
@@ -5652,12 +5626,6 @@ class Router {
5652
5626
  resetUrlToCurrentUrlTree() {
5653
5627
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5654
5628
  }
5655
- /** @internal */
5656
- cancelNavigationTransition(transition, reason, code) {
5657
- const navCancel = new NavigationCancel(transition.id, this.serializeUrl(transition.extractedUrl), reason, code);
5658
- this.triggerEvent(navCancel);
5659
- transition.resolve(false);
5660
- }
5661
5629
  generateNgRouterState(navigationId, routerPageId) {
5662
5630
  if (this.canceledNavigationResolution === 'computed') {
5663
5631
  return { navigationId, ɵrouterPageId: routerPageId };
@@ -5665,15 +5633,12 @@ class Router {
5665
5633
  return { navigationId };
5666
5634
  }
5667
5635
  }
5668
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5669
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, decorators: [{
5636
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5637
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: Router, providedIn: 'root' });
5638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: Router, decorators: [{
5671
5639
  type: Injectable,
5672
- args: [{
5673
- providedIn: 'root',
5674
- useFactory: setupRouter,
5675
- }]
5676
- }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5640
+ args: [{ providedIn: 'root' }]
5641
+ }], ctorParameters: function () { return []; } });
5677
5642
  function validateCommands(commands) {
5678
5643
  for (let i = 0; i < commands.length; i++) {
5679
5644
  const cmd = commands[i];
@@ -5963,9 +5928,9 @@ class RouterLink {
5963
5928
  });
5964
5929
  }
5965
5930
  }
5966
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5967
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterLink, isStandalone: true, selector: "[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" } }, usesOnChanges: true, ngImport: i0 });
5968
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLink, decorators: [{
5931
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5932
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: RouterLink, isStandalone: true, selector: "[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" } }, usesOnChanges: true, ngImport: i0 });
5933
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLink, decorators: [{
5969
5934
  type: Directive,
5970
5935
  args: [{
5971
5936
  selector: '[routerLink]',
@@ -6190,9 +6155,9 @@ class RouterLinkActive {
6190
6155
  return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
6191
6156
  }
6192
6157
  }
6193
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6194
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6195
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLinkActive, decorators: [{
6158
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6159
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLinkActive, decorators: [{
6196
6161
  type: Directive,
6197
6162
  args: [{
6198
6163
  selector: '[routerLinkActive]',
@@ -6252,9 +6217,9 @@ class PreloadAllModules {
6252
6217
  return fn().pipe(catchError(() => of(null)));
6253
6218
  }
6254
6219
  }
6255
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6256
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6220
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6221
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreloadAllModules, decorators: [{
6258
6223
  type: Injectable,
6259
6224
  args: [{ providedIn: 'root' }]
6260
6225
  }] });
@@ -6272,9 +6237,9 @@ class NoPreloading {
6272
6237
  return of(null);
6273
6238
  }
6274
6239
  }
6275
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6276
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6277
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, decorators: [{
6240
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6241
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NoPreloading, decorators: [{
6278
6243
  type: Injectable,
6279
6244
  args: [{ providedIn: 'root' }]
6280
6245
  }] });
@@ -6368,9 +6333,9 @@ class RouterPreloader {
6368
6333
  });
6369
6334
  }
6370
6335
  }
6371
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6372
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6373
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, decorators: [{
6336
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6337
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterPreloader, decorators: [{
6374
6339
  type: Injectable,
6375
6340
  args: [{ providedIn: 'root' }]
6376
6341
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
@@ -6384,9 +6349,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
6384
6349
  */
6385
6350
  const ROUTER_SCROLLER = new InjectionToken('');
6386
6351
  class RouterScroller {
6387
- constructor(router,
6388
- /** @docsNotRequired */ viewportScroller, zone, options = {}) {
6389
- this.router = router;
6352
+ /** @nodoc */
6353
+ constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
6354
+ this.urlSerializer = urlSerializer;
6355
+ this.transitions = transitions;
6390
6356
  this.viewportScroller = viewportScroller;
6391
6357
  this.zone = zone;
6392
6358
  this.options = options;
@@ -6409,7 +6375,7 @@ class RouterScroller {
6409
6375
  this.scrollEventsSubscription = this.consumeScrollEvents();
6410
6376
  }
6411
6377
  createScrollEvents() {
6412
- return this.router.events.subscribe(e => {
6378
+ return this.transitions.events.subscribe(e => {
6413
6379
  if (e instanceof NavigationStart) {
6414
6380
  // store the scroll position of the current stable navigations.
6415
6381
  this.store[this.lastId] = this.viewportScroller.getScrollPosition();
@@ -6418,12 +6384,12 @@ class RouterScroller {
6418
6384
  }
6419
6385
  else if (e instanceof NavigationEnd) {
6420
6386
  this.lastId = e.id;
6421
- this.scheduleScrollEvent(e, this.router.parseUrl(e.urlAfterRedirects).fragment);
6387
+ this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
6422
6388
  }
6423
6389
  });
6424
6390
  }
6425
6391
  consumeScrollEvents() {
6426
- return this.router.events.subscribe(e => {
6392
+ return this.transitions.events.subscribe(e => {
6427
6393
  if (!(e instanceof Scroll))
6428
6394
  return;
6429
6395
  // a popstate event. The pop state event will always ignore anchor scrolling.
@@ -6453,26 +6419,22 @@ class RouterScroller {
6453
6419
  // component by executing its update block of the template function.
6454
6420
  setTimeout(() => {
6455
6421
  this.zone.run(() => {
6456
- this.router.triggerEvent(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6422
+ this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6457
6423
  });
6458
6424
  }, 0);
6459
6425
  });
6460
6426
  }
6461
6427
  /** @nodoc */
6462
6428
  ngOnDestroy() {
6463
- if (this.routerEventsSubscription) {
6464
- this.routerEventsSubscription.unsubscribe();
6465
- }
6466
- if (this.scrollEventsSubscription) {
6467
- this.scrollEventsSubscription.unsubscribe();
6468
- }
6429
+ this.routerEventsSubscription?.unsubscribe();
6430
+ this.scrollEventsSubscription?.unsubscribe();
6469
6431
  }
6470
6432
  }
6471
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6472
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller });
6473
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, decorators: [{
6433
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6434
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterScroller });
6435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterScroller, decorators: [{
6474
6436
  type: Injectable
6475
- }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6437
+ }], ctorParameters: function () { return [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6476
6438
 
6477
6439
  /**
6478
6440
  * @license
@@ -6525,10 +6487,6 @@ function provideRouter(routes, ...features) {
6525
6487
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6526
6488
  { provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
6527
6489
  features.map(feature => feature.ɵproviders),
6528
- // TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
6529
- // how we want them to be configured. This API doesn't currently have a way to configure them
6530
- // and we should decide what the _best_ way to do that is rather than just sticking with the
6531
- // status quo of how it's done today.
6532
6490
  ]);
6533
6491
  }
6534
6492
  function rootRoute(router) {
@@ -6609,10 +6567,11 @@ function withInMemoryScrolling(options = {}) {
6609
6567
  const providers = [{
6610
6568
  provide: ROUTER_SCROLLER,
6611
6569
  useFactory: () => {
6612
- const router = inject(Router);
6613
6570
  const viewportScroller = inject(ViewportScroller);
6614
6571
  const zone = inject(NgZone);
6615
- return new RouterScroller(router, viewportScroller, zone, options);
6572
+ const transitions = inject(NavigationTransitions);
6573
+ const urlSerializer = inject(UrlSerializer);
6574
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);
6616
6575
  },
6617
6576
  }];
6618
6577
  return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
@@ -6915,7 +6874,7 @@ const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate
6915
6874
  const ROUTER_PROVIDERS = [
6916
6875
  Location,
6917
6876
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
6918
- { provide: Router, useFactory: setupRouter },
6877
+ Router,
6919
6878
  ChildrenOutletContexts,
6920
6879
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6921
6880
  RouterConfigLoader,
@@ -7012,10 +6971,10 @@ class RouterModule {
7012
6971
  };
7013
6972
  }
7014
6973
  }
7015
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7016
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
7017
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7018
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, decorators: [{
6974
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6975
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
6976
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6977
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, decorators: [{
7019
6978
  type: NgModule,
7020
6979
  args: [{
7021
6980
  imports: ROUTER_DIRECTIVES,
@@ -7035,14 +6994,15 @@ function provideRouterScroller() {
7035
6994
  return {
7036
6995
  provide: ROUTER_SCROLLER,
7037
6996
  useFactory: () => {
7038
- const router = inject(Router);
7039
6997
  const viewportScroller = inject(ViewportScroller);
7040
6998
  const zone = inject(NgZone);
7041
6999
  const config = inject(ROUTER_CONFIGURATION);
7000
+ const transitions = inject(NavigationTransitions);
7001
+ const urlSerializer = inject(UrlSerializer);
7042
7002
  if (config.scrollOffset) {
7043
7003
  viewportScroller.setOffset(config.scrollOffset);
7044
7004
  }
7045
- return new RouterScroller(router, viewportScroller, zone, config);
7005
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);
7046
7006
  },
7047
7007
  };
7048
7008
  }
@@ -7100,7 +7060,7 @@ function provideRouterInitializer() {
7100
7060
  /**
7101
7061
  * @publicApi
7102
7062
  */
7103
- const VERSION = new Version('15.0.1');
7063
+ const VERSION = new Version('15.0.3');
7104
7064
 
7105
7065
  /**
7106
7066
  * @license
@@ -7139,5 +7099,5 @@ const VERSION = new Version('15.0.1');
7139
7099
  * Generated bundle index. Do not edit.
7140
7100
  */
7141
7101
 
7142
- 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, RouterLink as 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 };
7102
+ 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, RouterLink as 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, flatten as ɵflatten, withPreloading as ɵwithPreloading };
7143
7103
  //# sourceMappingURL=router.mjs.map