{path:'home',component:HomeComponent}(主路由)
{
path:'home',component:HomeComponent,
chilren:[
{path:'/xxx',component:xxComponent};
{path:'/yyy’,component:yyyComponent}
]
}
2)辅助路由
(1)在app组件的模板中再定义一个插座
<router-outlet></router-outlet>
<router-outlet name="chat"></router-outlet>
(2)单独开发组件,只能显示在新定义的插座上
{path:'xxx',component:xxxComponent,outelet:'aux'},
{path:'yyy',component:yyyComponent.name:'aux'}
(3)通过路由参数控制新组件
<a [routerLink]="['/home',{outlets:{aux:'xxx'}}]">xxx</a>
<a [routerLink]="['/product',{outlet:{zux:'yyy'}}]">yyy</a>
(1)在app组件的模板中定义一个插座
(2)单独开发插件,在app组件中引入,并配置路由
ng g m chat --routing
ng g c chat
ng g chat s
(3)配置链接