我正在尝试实现延迟加载模块,但会出现错误。 我的使用System.js,也许我错了指出方向,如何计算?
我的app.module.ts:
import { NgModule } from '@angular/core';
imports ...
const APP_ROUTES: Routes = [
{ path: 'user', loadChildren: 'build/app/profile/user/user.module#UserModule' },
{ path: '', redirectTo: 'login', pathMatch: 'full' }
];
@NgModule({
imports: [RouterModule.forRoot(APP_ROUTES)],
exports: [RouterModule]
})
export class AppRoutingModule {}
我的user.module.ts:
import { NgModule } from '@angular/core';
imports...
@NgModule({
imports: [
CommonModule,
FormsModule,
UserRouterModule
],
declarations: [
UserComponent,
UserInfoComponent,
UserEditPasswordComponent
],
exports: [],
providers: [
AuthService,
UserGuard,
UserService
]
})
export class UserModule { }
我的user-router.module.ts:
import { Routes } from '@angular/router';
imports ...
export const USER_ROUTES: Routes = [
{ path: '', component: UserInfoComponent, pathMatch: 'full' },
{ path: 'edit', component: UserEditPasswordComponent },
{ path: 'candidates', component: CandidateListComponent },
{ path: 'add-candidate', component: CandidateAddComponent },
{ path: 'candidates/:id/edit', component: CandidateEditComponent }
];
@NgModule({
imports: [RouterModule.forChild(USER_ROUTES)],
exports: [RouterModule]
})
export class UserRouterModule {}
这里的结构和错误:
Structure of my project: Error
谢谢!