我正在处理我的项目,我想延迟加载我的模块,它工作正常,但是当我“ng serve”m 代码时,我收到此错误 “无法读取未定义的属性 'loadChildren'”
这是我的应用路由模块
export const appRoutes: Routes = [
{
path: '',
redirectTo: 'login',
pathMatch: 'full',
canActivate: [AuthGuard]
},
{ path: 'login', component: LoginComponent },
{
path: 'corrrisk',
component: WelcomeComponent,
children: [
{ path: '', component: CorrriskHomeComponent, pathMatch: 'full' },
{
path: 'security',
loadChildren: './modules/security/security.module#CorrSecurityModule' ,
data: { preload: false }
},
{
path: 'setup',
loadChildren: './modules/setup/setup.module#CorrSetupModule',
data: { preload: true }
},
{
path: 'limit',
loadChildren: './modules/limits/limits.module#CorrLimitModule'
},
{
path: 'businesspolicy',
loadChildren:
'./modules/businesspolicy/businesspolicy.module#CorrBusinessPolicyModule',
data: { preload: false }
}
]
}
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes, {
preloadingStrategy: SelectivePreloadingStrategy
})
],
exports: [RouterModule],
providers: [SelectivePreloadingStrategy]
})
export class AppRoutingModule {}
这是我的应用程序模块代码
@NgModule({
declarations: [
AppComponent,
LoginComponent,
WelcomeComponent,
CorrriskHomeComponent,
],
imports: [
BrowserModule,
BrowserAnimationsModule,
MatIconModule,
DxAccordionModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
AppRoutingModule,
DevExtremeModule,
CorrOperationsModule,
CorrCommonModule,
CorrMISModule,
NgReduxModule
],
providers: [
httpInterceptorProviders,
appStoreProviders,
{ provide: LOCALE_ID, useValue: 'en-US' }
],
bootstrap: [AppComponent]
})
export class AppModule {
constructor(
ngRedux: NgRedux<any>,
@Inject(AppStore) public store: Redux.Store<AppStateRedux>,
overlayContainer: OverlayContainer
) {
overlayContainer.getContainerElement().classList.add('unicorn-dark-theme');
ngRedux.configureStore(rootReducer, {}, [thunk], []);
}
}
当我在应用程序路由文件中放置空间时,它编译得很好。请告诉我上面代码中有什么问题。