我正在尝试将一个懒惰模块IdCardModule导入另一个名为EmployeeModule的懒惰模块中,但是当我尝试打开EmployeeModule路由时 / employee / create ,它总是打开IdCardModule的路由
const routes: Routes = [
{
path: '', component: EmployeesComponent,
children: [
{ path: '', component: OverviewComponent },
{ path: 'create', component:CreateComponent}
]
}
];
@NgModule({
imports: [
RouterModule.forChild(routes),
],
declarations: [
EmployeesComponent,
OverviewComponent,
CreateComponent
],
providers: [
EmployeeDetailService
]})
export class EmployeesModule { }
IdCardMododule
const routes: Routes = [
{
path: '', component: IdCardComponent,
children: [
{ path: '', component: OverviewComponent },
{ path: 'CreateComponent', component:CreateIdCardComponent}
]
}
];
@NgModule({
imports: [
RouterModule.forChild(routes),
IdCardModule
],
declarations: [
ICardComponent,
OverviewComponent,
CreateIdCardComponent
],
providers: [
IdCardService
]})
export class IdCardsModule{ }
带有子路线的AppModule
const routes = [
{ path: '', loadChildren: './modules/dashboard/dashboard.module#DashboardModule' },
{ path: 'employee', loadChildren: './modules/employees/employees.module#EmployeesModule', canActivate: [RouteGuard] },
{ path: 'idcard', loadChildren: './modules/identity-card/id-cards.module#IdCardsModule', canActivate: [RouteGuard] },
];
@NgModule({
imports: [
RouterModule.forRoot(routes),
})
],