On this page
provideRouter
function  developer preview 
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.
provideRouter(routes: Routes, ...features: RouterFeatures[]): Provider[]
    Parameters
routes | 
        Routes | 
        A set of   | 
       
features | 
        RouterFeatures[] | 
        Optional features to configure additional router behaviors.  | 
       
Returns
Provider[]: A set of providers to setup a Router.
See also
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'}))
    ]
  }
);
  © 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://v14.angular.io/api/router/provideRouter