大孩子路由在延迟加载中不起作用

时间:2019-05-21 14:02:21

标签: angular lazy-loading

大孩子路由在延迟加载中不起作用

我的项目的结构:

app.routing.ts

{
    path: 'app',
    component: DashboardlayoutComponent,
    canActivate: [AuthgaurdService],
    children: [
      { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
      { path: 'dashboard', component: DashboardComponent },
      { path: 'threats', component: ThreatsComponent },
      { path: 'intrusions', component: IntrusionsComponent },
{ 
        path:'eba',
        component:EbaComponent,
        children: [
            { 
              path: '',
              redirectTo: 'ebadashboard',
              pathMatch: 'full' 
            },
            {
              path:'ebadashboard',
              component:EbaDashboardComponent
            },
            {
              path:'ebaalerts',
              component:AlertsComponent
            },
]
}

延迟加载后:

app.routing.ts

{
    path: 'app',
    loadChildren: 'app/dashboardlayout/dashboardlayout.module#DashboardlayoutModule',
    canActivate: [AuthgaurdService]
  },
  {
    path: 'eba',
    loadChildren: 'app/dashboardlayout/eba/eba.module#EbaModule'
  },
  {
    path: 'deception',
    loadChildren: 'app/dashboardlayout/deception/deception.module#DeceptionModule'
  },

eba.routing.ts

 {
    path: 'eba',
    //component: EbaComponent,
     children: [
      {
        path: '',
        redirectTo: 'ebadashboard',
        pathMatch: 'full'
      },
      {
        path: 'ebadashboard',
        component: EbaDashboardComponent

      },
      {
        path: 'ebaalerts',
        component: AlertsComponent
      },

当我单击eba组件时,出现404错误

0 个答案:

没有答案