Angular 10 References/ Router
References

Route interface

Routes is an array of route configurations. Pass it to the RouterModule.forRoot or forChild method in the module imports to configure the router.

Example

...
RouterModule.forRoot([
  {
    path: 'team/:id',
    component: Team,
    children: [{
      path: 'user/:name',
      component: User,
    }],
  },
]),

Options

canActivate#

canActivate?: any[]
An array of DI tokens used to look up [`CanActivate`](../canactivate-interface) handlers.

canActivateChild#

canActivateChild?: any[]
An array of DI tokens used to look up [`CanActivateChild`](../canactivatechild-interface) handlers.

canDeactivate#

canDeactivate?: any[]
An array of DI tokens used to look up [`CanDeactivate`](../candeactivate-interface) handlers.

canLoad#

canLoad?: any[]
An array of DI tokens used to look up [`CanLoad`](../canload-interface) handlers.

children#

children?: Routes
An array of child route definitions.

component#

component?: Type<any>
A component type.

data#

data?: Data
Additional data provided to the component via [`ActivatedRoute`](../activatedroute).

loadChildren#

loadChildren?: LoadChildren
A reference to lazy loaded child routes.
Links & Tutorials

matcher#

matcher?: UrlMatcher
Defines a [custom strategy for path matching](../urlmatcher) and supersedes `path` and `pathMatch`.

outlet#

outlet?: string
The name of the outlet the component should be placed into.
Links & Tutorials

path#

path?: string
A string that uses the [route matcher DSL](../urlmatcher).

pathMatch#

pathMatch?: string
A string that specifies the matching strategy.

redirectTo#

redirectTo?: string
The url fragment which will replace the current matched segment.
Links & Tutorials

resolve#

resolve?: ResolveData
A map of DI tokens used to look up [data resolvers](../resolve-interface).
Links & Tutorials

runGuardsAndResolvers#

runGuardsAndResolvers?: RunGuardsAndResolvers
Defines when guards and resolvers will be run. By default they run only when the matrix parameters of the route change. When set to `paramsOrQueryParamsChange` they will also run when query params change. And when set to always, they will run every time.