◐ Shell
clean mode source ↗

RouterModule • Angular

Adds directives and providers for in-app navigation among views defined in an application. Use the Angular Router service to declaratively specify application states and manage state transitions.

You can import this NgModule multiple times, once for each lazy-loaded bundle. However, only one Router service can be active. To ensure this, there are two ways to register routes when importing this module:

  • The forRoot() method creates an NgModule that contains all the directives, the given routes, and the Router service itself.
  • The forChild() method creates an NgModule that contains all the directives and the given routes, but does not include the Router service.