我使用Angular 9,并且想要进行懒加载,我正在使用app-routing
{
path: '', loadChildren: () => import("./components/login/login.module")//.then(m =>
// m.LoginModule)
}
然后我创建了登录模块:
@NgModule({
declarations: [LoginComponent],
imports: [
CommonModule,
FormsModule,
LoginModuleRouting
],
providers:[]
})
export class LoginModule { }
路由:
const routes: Routes = [
{
path: '', component: LoginComponent,
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class LoginModuleRouting { }
当我调用
ng serve
并访问http://localhost:4200/时,出现以下异常:core.js:6237
ERROR Error: Uncaught (in promise): Error: ASSERTION ERROR: NgModule '[object Module]' is not a subtype of 'NgModuleType'. [Expected=> null != null <=Actual]
Error: ASSERTION ERROR: NgModule '[object Module]' is not a subtype of 'NgModuleType'. [Expected=> null != null <=Actual]
我不知道这是什么意思。有人能帮助我吗?
imports: [RouterModule.forRoot(routes)]
? - brandt.codes