【问题标题】:Error: Cannot find module './dashboard/dashboard.module' Error: Cannot find module './dashboard/dashboard.module' angular 8错误:找不到模块 './dashboard/dashboard.module' 错误:找不到模块 './dashboard/dashboard.module' 角度 8
【发布时间】:2020-02-12 20:51:41
【问题描述】:

app-routing-module.ts

 const routes: Routes = [   {
    path: '',
    component: CmsLayoutComponent,
    canActivate: [],
     children: [
       {
         path: '',
        loadChildren: './dashboard/dashboard.module#DashboardModule',
       }
    ]   } ];

我有以下错误表明在路由中添加了新模块但找不到路径。

Uncaught (in promise): Error: Cannot find module './dashboard/dashboard.module'
Error: Cannot find module './dashboard/dashboard.module'

enter image description here

【问题讨论】:

    标签: angular7 angular8


    【解决方案1】:

    请遵循以下模式:

    const routes: Routes = [   {
        path: '',
        component: CmsLayoutComponent,
        canActivate: [],
         children: [
            {
            path: 'dashboard',
            loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule)
          }
        ]   } ];
    
    
    
    ];
    

    【讨论】:

      猜你喜欢
      • 2018-01-11
      • 1970-01-01
      • 2021-01-20
      • 1970-01-01
      • 2018-12-30
      • 2017-03-18
      • 1970-01-01
      • 2016-12-20
      • 1970-01-01
      相关资源
      最近更新 更多