我有以下问题。我正在使用angular2延迟加载,我遇到了'找不到模块'的错误。这是我的文件夹结构:
const APP_ROUTES: Routes = [
{ path: '', redirectTo: 'app/home', pathMatch: 'full' },
{
path: 'app', component: MainComponent, canActivate: [AuthGuard], canLoad: [AuthGuard], children: [
{ path: 'home', loadChildren: 'home.module'},
]
},
{ path: 'authenticate', loadChildren: 'authenticate.module' },
{ path: '**', component: PageNotFoundComponent }
]
@NgModule({
imports: [
RouterModule.forRoot(APP_ROUTES),
],
exports: [
RouterModule
]
})
export class AppRoutingModule { }
我的HomeModule看起来像这样:
export const HOME_ROUTES: Routes = [
{ path: '', component: HomeComponent }
];
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(HOME_ROUTES)
],
declarations: [HomeComponent]
})
export default class HomeModule { }