Spec-Zone.ru › Angular

provideRouter

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.

RouterRouterFeatures

API

function provideRouter(
  routes: Routes,
  ...features: RouterFeatures[]
): EnvironmentProviders;
@paramroutesRoutes

A set of Routes to use for the application routing table.

@paramfeaturesRouterFeatures[]

Optional features to configure additional router behaviors.

@returnsEnvironmentProviders

A set of providers to setup a Router.

Usage Notes

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'}))
    ]
  }
);

Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/router/provideRouter

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API