Angular 5 lazy loading Error: Cannot find module

前端 未结 8 1909
栀梦
栀梦 2021-01-02 08:13

I would like to use lazy loading but I can not understand why it does not work, it gives me error \"Cannot find module\".
This is my environment:
- Angular 5.2.1

8条回答
  •  没有蜡笔的小新
    2021-01-02 08:41

    try to do n your user.module.ts:

    import {UserRoutes } from './User.routing'
    
    @NgModule({
        imports: [
            CommonModule,
            FormsModule,
            UsersRoutingModule.forChild(UserRoutes), //<-- for child
            RouterModule
        ],
        declarations: [
            UsersComponent,
            UserFormComponent,
            UsersListComponent,
            UserViewComponent
        ],
        providers: [
            UsersResolver,
            RouterModule
        ]
    })
    export class UsersModule { }
    

提交回复
热议问题