[英]Angular routing - routing to a lazy module child path does not initiate the component
在我的app-routing.module中,我有一個懶惰的模塊:
const appRoutes: Routes = [
{ path: 'profile/:id',
loadChildren: './profile/profile-standalone/profile-standalone.module#ProfileStandaloneModule',
}
];
這是我的個人資料 - standalone-routing.module-
const routes: Routes = [
{
path: '',
component: ProfileStandaloneComponent,
children: [
{
path: '',
redirectTo: 'outputa',
pathMatch: 'full'
},
{
path: 'outputa',
component: ProfileOutputComponent
}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ProfileStandaloneRoutingModule { }
但是當我去url“localhost:4200 / profile / 123 / outputa”時,我的“ProfileOutputComponent”沒有被調用。
知道如何讓它工作嗎?
嘗試這個。
const routes: Routes = [
{
path: 'outputa',
component: ProfileOutputComponent
];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.