【发布时间】:2019-07-12 06:29:55
【问题描述】:
这是站点信息路由模块
const routes: Routes = [
{
path: '', children: [
{
path: '',
component: WhyUsComponent
},
{
path: '',
component: WhoWeAreComponent
},
{
path: '',
component: WhatWeDoComponent
}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class SiteInfoRoutingModule { }
下面是应用路由模块。问题是所有路由的routerLink都转到第一个组件,这就是site-info模块中的why-us。 如果我在应用程序路由模块中保持路径为空,而是在 site-info-routing 模块的相应路径中添加why-us who-we-are和career-with-us,那么它可以工作,但这是最好的方法管理它?
{
path: 'why-us',
loadChildren: './site-info/site-info.module#SiteInfoModule',
},
{
path: 'who-we-are',
loadChildren: './site-info/site-info.module#SiteInfoModule',
},
{
path: 'what-we-do',
loadChildren: './site-info/site-info.module#SiteInfoModule',
}
【问题讨论】:
标签: angular