[英]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.