我有一个router-outlet
第一个布局。在/personnel
我想使用第二个。怎么做?我不想隐藏元素,因为personnel
它也有诸如personnel/users
等之类的组件。
我想加载personnel
为不在 main 内的独立组件router-outlet
。personnel
应该有它自己的router-outlet
。
让我们更清楚一点。
const appRoutes: Routes = [
{ // first layout (here is the first and for now the only one router-outlet
path: '',
children: [
{ path: '', component: SiteComponent, pathMatch: 'full' },
{ path: 'install', component: InstallationComponent, canActivate: [ InstallationAuth ] },
{ path: 'login', component: LoginComponent, canActivate: [ LoginAuth ] },
{ path: 'register', component: RegisterComponent },
{ path: 'reset', component: ResetComponent, canActivate: [ LoginAuth ] }
]
},
{ //second layout (personnel should have it's own router-outlet
path: 'personnel',
children: [
{ path: '', component: PersonnelComponent, canActivate: [ PersonnelAuth ]},
{ path: 'users', component: UsersComponent, outlet: 'personnel' }
]
}
];