当尝试导航到'http://localhost:4200/dashboard'的懒加载路由时,我遇到了这个错误,使用的是Angular和Angular-CLI 6.0.0。
错误:未捕获(在promise中):错误:找不到模块"app/dashboard/dashboard.module"。错误:找不到模块"app/dashboard/dashboard.module"。 在$_lazy_route_resource lazy namespace object:5处
const routes: Routes = [
{
path: 'login',
loadChildren: 'app/login/login.module#LoginModule',
},
{
path: '',
component: MasterComponent,
children: [
{
path: 'dashboard',
loadChildren: 'app/dashboard/dashboard.module#DashboardModule'
}
],
},
{
path: '**',
redirectTo: 'login
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
providers: []
})
export class AppRoutingModule {
}