/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { HashLocationStrategy, LOCATION_INITIALIZED, LocationStrategy, ViewportScroller } from '@angular/common'; import { APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ApplicationRef, ENVIRONMENT_INITIALIZER, EnvironmentInjector, inject, InjectFlags, InjectionToken, Injector, makeEnvironmentProviders, NgZone } from '@angular/core'; import { of, Subject } from 'rxjs'; import { INPUT_BINDER, RoutedComponentInputBinder } from './directives/router_outlet'; import { NavigationError, stringifyEvent } from './events'; import { NavigationTransitions } from './navigation_transition'; import { Router } from './router'; import { ROUTER_CONFIGURATION } from './router_config'; import { ROUTES } from './router_config_loader'; import { PreloadingStrategy, RouterPreloader } from './router_preloader'; import { ROUTER_SCROLLER, RouterScroller } from './router_scroller'; import { ActivatedRoute } from './router_state'; import { UrlSerializer } from './url_tree'; import { afterNextNavigation } from './utils/navigations'; /** * Sets up providers necessary to enable `Router` functionality for the application. * Allows to configure a set of routes as well as extra features that should be enabled. * * @usageNotes * * Basic example of how you can add a Router to your application: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, { * providers: [provideRouter(appRoutes)] * }); * ``` * * You can also enable optional features in the Router by adding functions from the `RouterFeatures` * type: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, * withDebugTracing(), * withRouterConfig({paramsInheritanceStrategy: 'always'})) * ] * } * ); * ``` * * @see {@link RouterFeatures} * * @publicApi * @param routes A set of `Route`s to use for the application routing table. * @param features Optional features to configure additional router behaviors. * @returns A set of providers to setup a Router. */ export function provideRouter(routes, ...features) { return makeEnvironmentProviders([ { provide: ROUTES, multi: true, useValue: routes }, (typeof ngDevMode === 'undefined' || ngDevMode) ? { provide: ROUTER_IS_PROVIDED, useValue: true } : [], { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] }, { provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener }, features.map(feature => feature.ɵproviders), ]); } export function rootRoute(router) { return router.routerState.root; } /** * Helper function to create an object that represents a Router feature. */ function routerFeature(kind, providers) { return { ɵkind: kind, ɵproviders: providers }; } /** * An Injection token used to indicate whether `provideRouter` or `RouterModule.forRoot` was ever * called. */ export const ROUTER_IS_PROVIDED = new InjectionToken('', { providedIn: 'root', factory: () => false }); const routerIsProvidedDevModeCheck = { provide: ENVIRONMENT_INITIALIZER, multi: true, useFactory() { return () => { if (!inject(ROUTER_IS_PROVIDED)) { console.warn('`provideRoutes` was called without `provideRouter` or `RouterModule.forRoot`. ' + 'This is likely a mistake.'); } }; } }; /** * Registers a [DI provider](guide/glossary#provider) for a set of routes. * @param routes The route configuration to provide. * * @usageNotes * * ``` * @NgModule({ * providers: [provideRoutes(ROUTES)] * }) * class LazyLoadedChildModule {} * ``` * * @deprecated If necessary, provide routes using the `ROUTES` `InjectionToken`. * @see {@link ROUTES} * @publicApi */ export function provideRoutes(routes) { return [ { provide: ROUTES, multi: true, useValue: routes }, (typeof ngDevMode === 'undefined' || ngDevMode) ? routerIsProvidedDevModeCheck : [], ]; } /** * Enables customizable scrolling behavior for router navigations. * * @usageNotes * * Basic example of how you can enable scrolling feature: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withInMemoryScrolling()) * ] * } * ); * ``` * * @see {@link provideRouter} * @see {@link ViewportScroller} * * @publicApi * @param options Set of configuration parameters to customize scrolling behavior, see * `InMemoryScrollingOptions` for additional information. * @returns A set of providers for use with `provideRouter`. */ export function withInMemoryScrolling(options = {}) { const providers = [{ provide: ROUTER_SCROLLER, useFactory: () => { const viewportScroller = inject(ViewportScroller); const zone = inject(NgZone); const transitions = inject(NavigationTransitions); const urlSerializer = inject(UrlSerializer); return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options); }, }]; return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers); } export function getBootstrapListener() { const injector = inject(Injector); return (bootstrappedComponentRef) => { const ref = injector.get(ApplicationRef); if (bootstrappedComponentRef !== ref.components[0]) { return; } const router = injector.get(Router); const bootstrapDone = injector.get(BOOTSTRAP_DONE); if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) { router.initialNavigation(); } injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading(); injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init(); router.resetRootComponentType(ref.componentTypes[0]); if (!bootstrapDone.closed) { bootstrapDone.next(); bootstrapDone.complete(); bootstrapDone.unsubscribe(); } }; } /** * A subject used to indicate that the bootstrapping phase is done. When initial navigation is * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing * to the activation phase. */ const BOOTSTRAP_DONE = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'bootstrap done indicator' : '', { factory: () => { return new Subject(); } }); const INITIAL_NAVIGATION = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ }); /** * Configures initial navigation to start before the root component is created. * * The bootstrap is blocked until the initial navigation is complete. This value is required for * [server-side rendering](guide/universal) to work. * * @usageNotes * * Basic example of how you can enable this navigation behavior: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withEnabledBlockingInitialNavigation()) * ] * } * ); * ``` * * @see {@link provideRouter} * * @publicApi * @returns A set of providers for use with `provideRouter`. */ export function withEnabledBlockingInitialNavigation() { const providers = [ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ }, { provide: APP_INITIALIZER, multi: true, deps: [Injector], useFactory: (injector) => { const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve()); return () => { return locationInitialized.then(() => { return new Promise(resolve => { const router = injector.get(Router); const bootstrapDone = injector.get(BOOTSTRAP_DONE); afterNextNavigation(router, () => { // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored // without a redirect. resolve(true); }); injector.get(NavigationTransitions).afterPreactivation = () => { // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we // assume activation will complete successfully (even though this is not // guaranteed). resolve(true); return bootstrapDone.closed ? of(void 0) : bootstrapDone; }; router.initialNavigation(); }); }); }; } }, ]; return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers); } /** * Disables initial navigation. * * Use if there is a reason to have more control over when the router starts its initial navigation * due to some complex initialization logic. * * @usageNotes * * Basic example of how you can disable initial navigation: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withDisabledInitialNavigation()) * ] * } * ); * ``` * * @see {@link provideRouter} * * @returns A set of providers for use with `provideRouter`. * * @publicApi */ export function withDisabledInitialNavigation() { const providers = [ { provide: APP_INITIALIZER, multi: true, useFactory: () => { const router = inject(Router); return () => { router.setUpLocationChangeListener(); }; } }, { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ } ]; return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers); } /** * Enables logging of all internal navigation events to the console. * Extra logging might be useful for debugging purposes to inspect Router event sequence. * * @usageNotes * * Basic example of how you can enable debug tracing: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withDebugTracing()) * ] * } * ); * ``` * * @see {@link provideRouter} * * @returns A set of providers for use with `provideRouter`. * * @publicApi */ export function withDebugTracing() { let providers = []; if (typeof ngDevMode === 'undefined' || ngDevMode) { providers = [{ provide: ENVIRONMENT_INITIALIZER, multi: true, useFactory: () => { const router = inject(Router); return () => router.events.subscribe((e) => { // tslint:disable:no-console console.group?.(`Router Event: ${e.constructor.name}`); console.log(stringifyEvent(e)); console.log(e); console.groupEnd?.(); // tslint:enable:no-console }); } }]; } else { providers = []; } return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers); } const ROUTER_PRELOADER = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'router preloader' : ''); /** * Allows to configure a preloading strategy to use. The strategy is configured by providing a * reference to a class that implements a `PreloadingStrategy`. * * @usageNotes * * Basic example of how you can configure preloading: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withPreloading(PreloadAllModules)) * ] * } * ); * ``` * * @see {@link provideRouter} * * @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that * should be used. * @returns A set of providers for use with `provideRouter`. * * @publicApi */ export function withPreloading(preloadingStrategy) { const providers = [ { provide: ROUTER_PRELOADER, useExisting: RouterPreloader }, { provide: PreloadingStrategy, useExisting: preloadingStrategy }, ]; return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers); } /** * Allows to provide extra parameters to configure Router. * * @usageNotes * * Basic example of how you can provide extra configuration options: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withRouterConfig({ * onSameUrlNavigation: 'reload' * })) * ] * } * ); * ``` * * @see {@link provideRouter} * * @param options A set of parameters to configure Router, see `RouterConfigOptions` for * additional information. * @returns A set of providers for use with `provideRouter`. * * @publicApi */ export function withRouterConfig(options) { const providers = [ { provide: ROUTER_CONFIGURATION, useValue: options }, ]; return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers); } /** * Provides the location strategy that uses the URL fragment instead of the history API. * * @usageNotes * * Basic example of how you can use the hash location option: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withHashLocation()) * ] * } * ); * ``` * * @see {@link provideRouter} * @see {@link HashLocationStrategy} * * @returns A set of providers for use with `provideRouter`. * * @publicApi */ export function withHashLocation() { const providers = [ { provide: LocationStrategy, useClass: HashLocationStrategy }, ]; return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers); } /** * Subscribes to the Router's navigation events and calls the given function when a * `NavigationError` happens. * * This function is run inside application's [injection context](guide/dependency-injection-context) * so you can use the [`inject`](api/core/inject) function. * * @usageNotes * * Basic example of how you can use the error handler option: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withNavigationErrorHandler((e: NavigationError) => * inject(MyErrorTracker).trackError(e))) * ] * } * ); * ``` * * @see {@link NavigationError} * @see {@link core/inject} * @see {@link runInInjectionContext} * * @returns A set of providers for use with `provideRouter`. * * @publicApi */ export function withNavigationErrorHandler(fn) { const providers = [{ provide: ENVIRONMENT_INITIALIZER, multi: true, useValue: () => { const injector = inject(EnvironmentInjector); inject(Router).events.subscribe((e) => { if (e instanceof NavigationError) { injector.runInContext(() => fn(e)); } }); } }]; return routerFeature(7 /* RouterFeatureKind.NavigationErrorHandlerFeature */, providers); } /** * Enables binding information from the `Router` state directly to the inputs of the component in * `Route` configurations. * * @usageNotes * * Basic example of how you can enable the feature: * ``` * const appRoutes: Routes = []; * bootstrapApplication(AppComponent, * { * providers: [ * provideRouter(appRoutes, withComponentInputBinding()) * ] * } * ); * ``` * * @returns A set of providers for use with `provideRouter`. */ export function withComponentInputBinding() { const providers = [ RoutedComponentInputBinder, { provide: INPUT_BINDER, useExisting: RoutedComponentInputBinder }, ]; return routerFeature(8 /* RouterFeatureKind.ComponentInputBindingFeature */, providers); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmlkZV9yb3V0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9yb3V0ZXIvc3JjL3Byb3ZpZGVfcm91dGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxvQkFBb0IsRUFBRSxvQkFBb0IsRUFBRSxnQkFBZ0IsRUFBRSxnQkFBZ0I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