1
Layout for all users兩個主要的路由器,網點用不同的佈局
Layout for personnel (like admin control panel)
我有一個router-outlet
其中有第一個佈局。在/personnel
我想用第二個。怎麼做?我不想隱藏元素,因爲personnel
也很喜歡personnel/users
等
成分,我想加載personnel
作爲獨立的組件,它不是主要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' }
]
}
];