标签:its nta contain pre back tle The routes for
Angular 提供了一种方式来把服务提供商从模块中分离出来,以便模块既可以带着 providers
被根模块导入,也可以不带 providers
被子模块导入。
`forRoot` creates a module that contains all the directives, the given routes, and the router service itself
`forChild` creates a module that contains all the directives and the given routes, but does not include the router service.
@NgModule({
declarations: ROUTER_DIRECTIVES,
exports: ROUTER_DIRECTIVES
})
const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive];
Angular之RouterModule的forRoot与forChild
标签:its nta contain pre back tle The routes for
原文地址:https://www.cnblogs.com/sea-breeze/p/9106434.html