` parent tag\n * when the URL is either '/user/jim' or '/user/bob'.\n *\n * ```\n *
\n * ```\n *\n * The `RouterLinkActive` directive can also be used to set the aria-current attribute\n * to provide an alternative distinction for active elements to visually impaired users.\n *\n * For example, the following code adds the 'active' class to the Home Page link when it is\n * indeed active and in such case also sets its aria-current attribute to 'page':\n *\n * ```\n *
Home Page\n * ```\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\n@Directive({\n selector: '[routerLinkActive]',\n exportAs: 'routerLinkActive',\n standalone: true,\n})\nexport class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit {\n @ContentChildren(RouterLink, {descendants: true}) links!: QueryList
;\n\n private classes: string[] = [];\n private routerEventsSubscription: Subscription;\n private linkInputChangesSubscription?: Subscription;\n private _isActive = false;\n\n get isActive() {\n return this._isActive;\n }\n\n /**\n * Options to configure how to determine if the router link is active.\n *\n * These options are passed to the `Router.isActive()` function.\n *\n * @see {@link Router#isActive}\n */\n @Input() routerLinkActiveOptions: {exact: boolean}|IsActiveMatchOptions = {exact: false};\n\n\n /**\n * Aria-current attribute to apply when the router link is active.\n *\n * Possible values: `'page'` | `'step'` | `'location'` | `'date'` | `'time'` | `true` | `false`.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current}\n */\n @Input() ariaCurrentWhenActive?: 'page'|'step'|'location'|'date'|'time'|true|false;\n\n /**\n *\n * You can use the output `isActiveChange` to get notified each time the link becomes\n * active or inactive.\n *\n * Emits:\n * true -> Route is active\n * false -> Route is inactive\n *\n * ```\n * Bob\n * ```\n */\n @Output() readonly isActiveChange: EventEmitter = new EventEmitter();\n\n constructor(\n private router: Router, private element: ElementRef, private renderer: Renderer2,\n private readonly cdr: ChangeDetectorRef, @Optional() private link?: RouterLink) {\n this.routerEventsSubscription = router.events.subscribe((s: Event) => {\n if (s instanceof NavigationEnd) {\n this.update();\n }\n });\n }\n\n /** @nodoc */\n ngAfterContentInit(): void {\n // `of(null)` is used to force subscribe body to execute once immediately (like `startWith`).\n of(this.links.changes, of(null)).pipe(mergeAll()).subscribe(_ => {\n this.update();\n this.subscribeToEachLinkOnChanges();\n });\n }\n\n private subscribeToEachLinkOnChanges() {\n this.linkInputChangesSubscription?.unsubscribe();\n const allLinkChanges = [...this.links.toArray(), this.link]\n .filter((link): link is RouterLink => !!link)\n .map(link => link.onChanges);\n this.linkInputChangesSubscription = from(allLinkChanges).pipe(mergeAll()).subscribe(link => {\n if (this._isActive !== this.isLinkActive(this.router)(link)) {\n this.update();\n }\n });\n }\n\n @Input()\n set routerLinkActive(data: string[]|string) {\n const classes = Array.isArray(data) ? data : data.split(' ');\n this.classes = classes.filter(c => !!c);\n }\n\n /** @nodoc */\n ngOnChanges(changes: SimpleChanges): void {\n this.update();\n }\n /** @nodoc */\n ngOnDestroy(): void {\n this.routerEventsSubscription.unsubscribe();\n this.linkInputChangesSubscription?.unsubscribe();\n }\n\n private update(): void {\n if (!this.links || !this.router.navigated) return;\n queueMicrotask(() => {\n const hasActiveLinks = this.hasActiveLinks();\n if (this._isActive !== hasActiveLinks) {\n this._isActive = hasActiveLinks;\n this.cdr.markForCheck();\n this.classes.forEach((c) => {\n if (hasActiveLinks) {\n this.renderer.addClass(this.element.nativeElement, c);\n } else {\n this.renderer.removeClass(this.element.nativeElement, c);\n }\n });\n if (hasActiveLinks && this.ariaCurrentWhenActive !== undefined) {\n this.renderer.setAttribute(\n this.element.nativeElement, 'aria-current', this.ariaCurrentWhenActive.toString());\n } else {\n this.renderer.removeAttribute(this.element.nativeElement, 'aria-current');\n }\n\n // Emit on isActiveChange after classes are updated\n this.isActiveChange.emit(hasActiveLinks);\n }\n });\n }\n\n private isLinkActive(router: Router): (link: RouterLink) => boolean {\n const options: boolean|IsActiveMatchOptions =\n isActiveMatchOptions(this.routerLinkActiveOptions) ?\n this.routerLinkActiveOptions :\n // While the types should disallow `undefined` here, it's possible without strict inputs\n (this.routerLinkActiveOptions.exact || false);\n return (link: RouterLink) => link.urlTree ? router.isActive(link.urlTree, options) : false;\n }\n\n private hasActiveLinks(): boolean {\n const isActiveCheckFn = this.isLinkActive(this.router);\n return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);\n }\n}\n\n/**\n * Use instead of `'paths' in options` to be compatible with property renaming\n */\nfunction isActiveMatchOptions(options: {exact: boolean}|\n IsActiveMatchOptions): options is IsActiveMatchOptions {\n return !!(options as IsActiveMatchOptions).paths;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Compiler, createEnvironmentInjector, EnvironmentInjector, Injectable, OnDestroy} from '@angular/core';\nimport {from, Observable, of, Subscription} from 'rxjs';\nimport {catchError, concatMap, filter, mergeAll, mergeMap} from 'rxjs/operators';\n\nimport {Event, NavigationEnd} from './events';\nimport {LoadedRouterConfig, Route, Routes} from './models';\nimport {Router} from './router';\nimport {RouterConfigLoader} from './router_config_loader';\n\n\n/**\n * @description\n *\n * Provides a preloading strategy.\n *\n * @publicApi\n */\nexport abstract class PreloadingStrategy {\n abstract preload(route: Route, fn: () => Observable): Observable;\n}\n\n/**\n * @description\n *\n * Provides a preloading strategy that preloads all modules as quickly as possible.\n *\n * ```\n * RouterModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules})\n * ```\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root'})\nexport class PreloadAllModules implements PreloadingStrategy {\n preload(route: Route, fn: () => Observable): Observable {\n return fn().pipe(catchError(() => of(null)));\n }\n}\n\n/**\n * @description\n *\n * Provides a preloading strategy that does not preload any modules.\n *\n * This strategy is enabled by default.\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root'})\nexport class NoPreloading implements PreloadingStrategy {\n preload(route: Route, fn: () => Observable): Observable {\n return of(null);\n }\n}\n\n/**\n * The preloader optimistically loads all router configurations to\n * make navigations into lazily-loaded sections of the application faster.\n *\n * The preloader runs in the background. When the router bootstraps, the preloader\n * starts listening to all navigation events. After every such event, the preloader\n * will check if any configurations can be loaded lazily.\n *\n * If a route is protected by `canLoad` guards, the preloaded will not load it.\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root'})\nexport class RouterPreloader implements OnDestroy {\n private subscription?: Subscription;\n\n constructor(\n private router: Router, compiler: Compiler, private injector: EnvironmentInjector,\n private preloadingStrategy: PreloadingStrategy, private loader: RouterConfigLoader) {}\n\n setUpPreloading(): void {\n this.subscription =\n this.router.events\n .pipe(filter((e: Event) => e instanceof NavigationEnd), concatMap(() => this.preload()))\n .subscribe(() => {});\n }\n\n preload(): Observable {\n return this.processRoutes(this.injector, this.router.config);\n }\n\n /** @nodoc */\n ngOnDestroy(): void {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n\n private processRoutes(injector: EnvironmentInjector, routes: Routes): Observable {\n const res: Observable[] = [];\n for (const route of routes) {\n if (route.providers && !route._injector) {\n route._injector =\n createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);\n }\n\n const injectorForCurrentRoute = route._injector ?? injector;\n const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;\n\n // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not\n // `loadComponent`. `canLoad` guards only block loading of child routes by design. This\n // happens as a consequence of needing to descend into children for route matching immediately\n // while component loading is deferred until route activation. Because `canLoad` guards can\n // have side effects, we cannot execute them here so we instead skip preloading altogether\n // when present. Lastly, it remains to be decided whether `canLoad` should behave this way\n // at all. Code splitting and lazy loading is separate from client-side authorization checks\n // and should not be used as a security measure to prevent loading of code.\n if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||\n (route.loadComponent && !route._loadedComponent)) {\n res.push(this.preloadConfig(injectorForCurrentRoute, route));\n }\n if (route.children || route._loadedRoutes) {\n res.push(this.processRoutes(injectorForChildren, (route.children ?? route._loadedRoutes)!));\n }\n }\n return from(res).pipe(mergeAll());\n }\n\n private preloadConfig(injector: EnvironmentInjector, route: Route): Observable {\n return this.preloadingStrategy.preload(route, () => {\n let loadedChildren$: Observable;\n if (route.loadChildren && route.canLoad === undefined) {\n loadedChildren$ = this.loader.loadChildren(injector, route);\n } else {\n loadedChildren$ = of(null);\n }\n\n const recursiveLoadChildren$ =\n loadedChildren$.pipe(mergeMap((config: LoadedRouterConfig|null) => {\n if (config === null) {\n return of(void 0);\n }\n route._loadedRoutes = config.routes;\n route._loadedInjector = config.injector;\n // If the loaded config was a module, use that as the module/module injector going\n // forward. Otherwise, continue using the current module/module injector.\n return this.processRoutes(config.injector ?? injector, config.routes);\n }));\n if (route.loadComponent && !route._loadedComponent) {\n const loadComponent$ = this.loader.loadComponent(route);\n return from([recursiveLoadChildren$, loadComponent$]).pipe(mergeAll());\n } else {\n return recursiveLoadChildren$;\n }\n });\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ViewportScroller} from '@angular/common';\nimport {Injectable, InjectionToken, NgZone, OnDestroy} from '@angular/core';\nimport {Unsubscribable} from 'rxjs';\n\nimport {NavigationEnd, NavigationSkipped, NavigationSkippedCode, NavigationStart, Scroll} from './events';\nimport {NavigationTransitions} from './navigation_transition';\nimport {UrlSerializer} from './url_tree';\n\nexport const ROUTER_SCROLLER = new InjectionToken('');\n\n@Injectable()\nexport class RouterScroller implements OnDestroy {\n private routerEventsSubscription?: Unsubscribable;\n private scrollEventsSubscription?: Unsubscribable;\n\n private lastId = 0;\n private lastSource: 'imperative'|'popstate'|'hashchange'|undefined = 'imperative';\n private restoredId = 0;\n private store: {[key: string]: [number, number]} = {};\n\n /** @nodoc */\n constructor(\n readonly urlSerializer: UrlSerializer, private transitions: NavigationTransitions,\n public readonly viewportScroller: ViewportScroller, private readonly zone: NgZone,\n private options: {\n scrollPositionRestoration?: 'disabled'|'enabled'|'top',\n anchorScrolling?: 'disabled'|'enabled'\n } = {}) {\n // Default both options to 'disabled'\n options.scrollPositionRestoration = options.scrollPositionRestoration || 'disabled';\n options.anchorScrolling = options.anchorScrolling || 'disabled';\n }\n\n init(): void {\n // we want to disable the automatic scrolling because having two places\n // responsible for scrolling results race conditions, especially given\n // that browser don't implement this behavior consistently\n if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.setHistoryScrollRestoration('manual');\n }\n this.routerEventsSubscription = this.createScrollEvents();\n this.scrollEventsSubscription = this.consumeScrollEvents();\n }\n\n private createScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (e instanceof NavigationStart) {\n // store the scroll position of the current stable navigations.\n this.store[this.lastId] = this.viewportScroller.getScrollPosition();\n this.lastSource = e.navigationTrigger;\n this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;\n } else if (e instanceof NavigationEnd) {\n this.lastId = e.id;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);\n } else if (\n e instanceof NavigationSkipped &&\n e.code === NavigationSkippedCode.IgnoredSameUrlNavigation) {\n this.lastSource = undefined;\n this.restoredId = 0;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.url).fragment);\n }\n });\n }\n\n private consumeScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (!(e instanceof Scroll)) return;\n // a popstate event. The pop state event will always ignore anchor scrolling.\n if (e.position) {\n if (this.options.scrollPositionRestoration === 'top') {\n this.viewportScroller.scrollToPosition([0, 0]);\n } else if (this.options.scrollPositionRestoration === 'enabled') {\n this.viewportScroller.scrollToPosition(e.position);\n }\n // imperative navigation \"forward\"\n } else {\n if (e.anchor && this.options.anchorScrolling === 'enabled') {\n this.viewportScroller.scrollToAnchor(e.anchor);\n } else if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.scrollToPosition([0, 0]);\n }\n }\n });\n }\n\n private scheduleScrollEvent(routerEvent: NavigationEnd|NavigationSkipped, anchor: string|null):\n void {\n this.zone.runOutsideAngular(() => {\n // The scroll event needs to be delayed until after change detection. Otherwise, we may\n // attempt to restore the scroll position before the router outlet has fully rendered the\n // component by executing its update block of the template function.\n setTimeout(() => {\n this.zone.run(() => {\n this.transitions.events.next(new Scroll(\n routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null,\n anchor));\n });\n }, 0);\n });\n }\n\n /** @nodoc */\n ngOnDestroy() {\n this.routerEventsSubscription?.unsubscribe();\n this.scrollEventsSubscription?.unsubscribe();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HashLocationStrategy, LOCATION_INITIALIZED, LocationStrategy, ViewportScroller} from '@angular/common';\nimport {APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ApplicationRef, Component, ComponentRef, ENVIRONMENT_INITIALIZER, EnvironmentInjector, EnvironmentProviders, inject, InjectFlags, InjectionToken, Injector, makeEnvironmentProviders, NgZone, Provider, Type} from '@angular/core';\nimport {of, Subject} from 'rxjs';\n\nimport {INPUT_BINDER, RoutedComponentInputBinder} from './directives/router_outlet';\nimport {Event, NavigationError, stringifyEvent} from './events';\nimport {Routes} from './models';\nimport {NavigationTransitions} from './navigation_transition';\nimport {Router} from './router';\nimport {InMemoryScrollingOptions, ROUTER_CONFIGURATION, RouterConfigOptions} from './router_config';\nimport {ROUTES} from './router_config_loader';\nimport {PreloadingStrategy, RouterPreloader} from './router_preloader';\nimport {ROUTER_SCROLLER, RouterScroller} from './router_scroller';\nimport {ActivatedRoute} from './router_state';\nimport {UrlSerializer} from './url_tree';\nimport {afterNextNavigation} from './utils/navigations';\n\n\n/**\n * Sets up providers necessary to enable `Router` functionality for the application.\n * Allows to configure a set of routes as well as extra features that should be enabled.\n *\n * @usageNotes\n *\n * Basic example of how you can add a Router to your application:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent, {\n * providers: [provideRouter(appRoutes)]\n * });\n * ```\n *\n * You can also enable optional features in the Router by adding functions from the `RouterFeatures`\n * type:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes,\n * withDebugTracing(),\n * withRouterConfig({paramsInheritanceStrategy: 'always'}))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link RouterFeatures}\n *\n * @publicApi\n * @param routes A set of `Route`s to use for the application routing table.\n * @param features Optional features to configure additional router behaviors.\n * @returns A set of providers to setup a Router.\n */\nexport function provideRouter(routes: Routes, ...features: RouterFeatures[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n {provide: ROUTES, multi: true, useValue: routes},\n (typeof ngDevMode === 'undefined' || ngDevMode) ?\n {provide: ROUTER_IS_PROVIDED, useValue: true} :\n [],\n {provide: ActivatedRoute, useFactory: rootRoute, deps: [Router]},\n {provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener},\n features.map(feature => feature.ɵproviders),\n ]);\n}\n\nexport function rootRoute(router: Router): ActivatedRoute {\n return router.routerState.root;\n}\n\n/**\n * Helper type to represent a Router feature.\n *\n * @publicApi\n */\nexport interface RouterFeature {\n ɵkind: FeatureKind;\n ɵproviders: Provider[];\n}\n\n/**\n * Helper function to create an object that represents a Router feature.\n */\nfunction routerFeature(\n kind: FeatureKind, providers: Provider[]): RouterFeature {\n return {ɵkind: kind, ɵproviders: providers};\n}\n\n\n/**\n * An Injection token used to indicate whether `provideRouter` or `RouterModule.forRoot` was ever\n * called.\n */\nexport const ROUTER_IS_PROVIDED =\n new InjectionToken('', {providedIn: 'root', factory: () => false});\n\nconst routerIsProvidedDevModeCheck = {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory() {\n return () => {\n if (!inject(ROUTER_IS_PROVIDED)) {\n console.warn(\n '`provideRoutes` was called without `provideRouter` or `RouterModule.forRoot`. ' +\n 'This is likely a mistake.');\n }\n };\n }\n};\n\n/**\n * Registers a [DI provider](guide/glossary#provider) for a set of routes.\n * @param routes The route configuration to provide.\n *\n * @usageNotes\n *\n * ```\n * @NgModule({\n * providers: [provideRoutes(ROUTES)]\n * })\n * class LazyLoadedChildModule {}\n * ```\n *\n * @deprecated If necessary, provide routes using the `ROUTES` `InjectionToken`.\n * @see {@link ROUTES}\n * @publicApi\n */\nexport function provideRoutes(routes: Routes): Provider[] {\n return [\n {provide: ROUTES, multi: true, useValue: routes},\n (typeof ngDevMode === 'undefined' || ngDevMode) ? routerIsProvidedDevModeCheck : [],\n ];\n}\n\n/**\n * A type alias for providers returned by `withInMemoryScrolling` for use with `provideRouter`.\n *\n * @see {@link withInMemoryScrolling}\n * @see {@link provideRouter}\n *\n * @publicApi\n */\nexport type InMemoryScrollingFeature = RouterFeature;\n\n/**\n * Enables customizable scrolling behavior for router navigations.\n *\n * @usageNotes\n *\n * Basic example of how you can enable scrolling feature:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withInMemoryScrolling())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n * @see {@link ViewportScroller}\n *\n * @publicApi\n * @param options Set of configuration parameters to customize scrolling behavior, see\n * `InMemoryScrollingOptions` for additional information.\n * @returns A set of providers for use with `provideRouter`.\n */\nexport function withInMemoryScrolling(options: InMemoryScrollingOptions = {}):\n InMemoryScrollingFeature {\n const providers = [{\n provide: ROUTER_SCROLLER,\n useFactory: () => {\n const viewportScroller = inject(ViewportScroller);\n const zone = inject(NgZone);\n const transitions = inject(NavigationTransitions);\n const urlSerializer = inject(UrlSerializer);\n return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);\n },\n }];\n return routerFeature(RouterFeatureKind.InMemoryScrollingFeature, providers);\n}\n\nexport function getBootstrapListener() {\n const injector = inject(Injector);\n return (bootstrappedComponentRef: ComponentRef) => {\n const ref = injector.get(ApplicationRef);\n\n if (bootstrappedComponentRef !== ref.components[0]) {\n return;\n }\n\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n\n if (injector.get(INITIAL_NAVIGATION) === InitialNavigation.EnabledNonBlocking) {\n router.initialNavigation();\n }\n\n injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();\n injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();\n router.resetRootComponentType(ref.componentTypes[0]);\n if (!bootstrapDone.closed) {\n bootstrapDone.next();\n bootstrapDone.complete();\n bootstrapDone.unsubscribe();\n }\n };\n}\n\n/**\n * A subject used to indicate that the bootstrapping phase is done. When initial navigation is\n * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing\n * to the activation phase.\n */\nconst BOOTSTRAP_DONE = new InjectionToken>(\n (typeof ngDevMode === 'undefined' || ngDevMode) ? 'bootstrap done indicator' : '', {\n factory: () => {\n return new Subject();\n }\n });\n\n/**\n * This and the INITIAL_NAVIGATION token are used internally only. The public API side of this is\n * configured through the `ExtraOptions`.\n *\n * When set to `EnabledBlocking`, the initial navigation starts before the root\n * component is created. The bootstrap is blocked until the initial navigation is complete. This\n * value is required for [server-side rendering](guide/universal) to work.\n *\n * When set to `EnabledNonBlocking`, the initial navigation starts after the root component has been\n * created. The bootstrap is not blocked on the completion of the initial navigation.\n *\n * When set to `Disabled`, the initial navigation is not performed. The location listener is set up\n * before the root component gets created. Use if there is a reason to have more control over when\n * the router starts its initial navigation due to some complex initialization logic.\n *\n * @see {@link ExtraOptions}\n */\nconst enum InitialNavigation {\n EnabledBlocking,\n EnabledNonBlocking,\n Disabled,\n}\n\nconst INITIAL_NAVIGATION = new InjectionToken(\n (typeof ngDevMode === 'undefined' || ngDevMode) ? 'initial navigation' : '',\n {providedIn: 'root', factory: () => InitialNavigation.EnabledNonBlocking});\n\n/**\n * A type alias for providers returned by `withEnabledBlockingInitialNavigation` for use with\n * `provideRouter`.\n *\n * @see {@link withEnabledBlockingInitialNavigation}\n * @see {@link provideRouter}\n *\n * @publicApi\n */\nexport type EnabledBlockingInitialNavigationFeature =\n RouterFeature;\n\n/**\n * A type alias for providers returned by `withEnabledBlockingInitialNavigation` or\n * `withDisabledInitialNavigation` functions for use with `provideRouter`.\n *\n * @see {@link withEnabledBlockingInitialNavigation}\n * @see {@link withDisabledInitialNavigation}\n * @see {@link provideRouter}\n *\n * @publicApi\n */\nexport type InitialNavigationFeature =\n EnabledBlockingInitialNavigationFeature|DisabledInitialNavigationFeature;\n\n/**\n * Configures initial navigation to start before the root component is created.\n *\n * The bootstrap is blocked until the initial navigation is complete. This value is required for\n * [server-side rendering](guide/universal) to work.\n *\n * @usageNotes\n *\n * Basic example of how you can enable this navigation behavior:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withEnabledBlockingInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @publicApi\n * @returns A set of providers for use with `provideRouter`.\n */\nexport function withEnabledBlockingInitialNavigation(): EnabledBlockingInitialNavigationFeature {\n const providers = [\n {provide: INITIAL_NAVIGATION, useValue: InitialNavigation.EnabledBlocking},\n {\n provide: APP_INITIALIZER,\n multi: true,\n deps: [Injector],\n useFactory: (injector: Injector) => {\n const locationInitialized: Promise =\n injector.get(LOCATION_INITIALIZED, Promise.resolve());\n\n return () => {\n return locationInitialized.then(() => {\n return new Promise(resolve => {\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n afterNextNavigation(router, () => {\n // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored\n // without a redirect.\n resolve(true);\n });\n\n injector.get(NavigationTransitions).afterPreactivation = () => {\n // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we\n // assume activation will complete successfully (even though this is not\n // guaranteed).\n resolve(true);\n return bootstrapDone.closed ? of(void 0) : bootstrapDone;\n };\n router.initialNavigation();\n });\n });\n };\n }\n },\n ];\n return routerFeature(RouterFeatureKind.EnabledBlockingInitialNavigationFeature, providers);\n}\n\n/**\n * A type alias for providers returned by `withDisabledInitialNavigation` for use with\n * `provideRouter`.\n *\n * @see {@link withDisabledInitialNavigation}\n * @see {@link provideRouter}\n *\n * @publicApi\n */\nexport type DisabledInitialNavigationFeature =\n RouterFeature;\n\n/**\n * Disables initial navigation.\n *\n * Use if there is a reason to have more control over when the router starts its initial navigation\n * due to some complex initialization logic.\n *\n * @usageNotes\n *\n * Basic example of how you can disable initial navigation:\n * ```\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withDisabledInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nexport function withDisabledInitialNavigation(): DisabledInitialNavigationFeature {\n const providers = [\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => {\n const router = inject(Router);\n return () => {\n router.setUpLocationChangeListener();\n };\n }\n },\n {provide: INITIAL_NAVIGATION, useValue: InitialNavigation.Disabled}\n ];\n return routerFeature(RouterFeatureKind.DisabledInitialNavigationFeature, providers);\n}\n\n/**\n * A type alias for providers returned by `withDebugTracing` for use with `provideRouter`.\n *\n * @see {@link withDebugTracing}\n * @see {@link provideRouter}\n *\n * @publicApi\n */\nexport type DebugTracingFeature = RouterFeature