30秒学会 Angular 片段 · 2019年4月15日

30秒学会 Angular 片段 – Router module

When having a separate routing module, instead of creating an NgModule you can export router configuration directly:

export const AppRoutingModule = RouterModule.forRoot(routes, config);

or

export const FeatureRoutingModule = RouterModule.forChild(routes);

and use it in your module

@NgModule({
  imports: [
    ...
    AppRoutingModule,
    ...
  ]
})

翻译自:https://www.30secondsofcode.org/angular/s/router-module

相关链接