1
您好我有我的路線文件中設置了這樣角2 - 兒童航線有不同的父組件到父組件
const routes: Routes = [
{ path: '', component: parentComponent, canActivate: [ LoggedInGuard ], children: [
{ path: 'profile', component: ProfileComponent },
{ path: 'sign-out', component: SignOutComponent },
{ path: 'set-password', component: SetPasswordComponent },
{ path: '', canActivate: [ LastLoginDateGuard ], children: [
{ path: 'admin', canActivate: [ adminGuard ], children: [
{ path: 'event/:event_id', component: appComponent, children: [
{ path: '', component: EventComponent }
]},
]},
]},
{ path: '', redirectTo: '/sign-in', pathMatch: 'full' },
]},
{ path: '', component: AppComponent },
{ path: 'home', component: HomeComponent },
{ path: 'sign-in', component: SignInComponent },
{ path: 'sign-up', component: SignUpComponent },
{ path: '**', component: PageNotFoundComponent }
];
我需要的是爲event/:event_id
路線具有不同的父組件的正常parentComponent
{ path: 'admin', canActivate: [ adminGuard ], children: [
{ path: 'event/:event_id', component: appComponent, children: [
{ path: '', component: EventComponent }
]},
]},
我基本上只是想event/:event_id
父組件是appComponent
不是parentCompnent
我想我可以這樣做只是讓我的路線文件更大 – SCRATK
@S CRATK,那麼你可以使用lazyloading並分開路由文件。 –