Angular2延迟加载 - 找不到模块

时间:2017-05-15 13:37:17

标签: angular angular2-routing

我有以下问题。我正在使用angular2延迟加载,我遇到了'找不到模块'的错误。这是我的文件夹结构:

enter image description here

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 { }

0 个答案:

没有答案