Angular6 如何在角路由中嵌套多个级别路由?

Angular6 如何在角路由中嵌套多个级别路由?,angular6,angular-routing,Angular6,Angular Routing,我使用angular 6制作了一个用于管理数据的仪表板应用程序。但当我嵌套超过1条懒虫路线时,我卡住了,这不起作用,似乎不能在角形路由器中添加超过1条懒虫路线 我的应用程序路由: const appRoutes: Routes = [ { path: '', component: SigninComponent, pathMatch: 'full' }, { path: 'dashboard', loadChildren: './core/da

我使用angular 6制作了一个用于管理数据的仪表板应用程序。但当我嵌套超过1条懒虫路线时,我卡住了,这不起作用,似乎不能在角形路由器中添加超过1条懒虫路线

我的应用程序路由:

const appRoutes: Routes = [
  {
    path: '',
    component: SigninComponent,
    pathMatch: 'full'
  },
  {
    path: 'dashboard',
    loadChildren: './core/dashboard/dashboard.module#DashboardModule'
  }
];
@NgModule({
  imports: [
    RouterModule.forRoot(appRoutes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule {}
我的仪表板路线

const dashboardRoutes: Routes = [
  {
    path: '',
    component: DashboardComponent,
    children: [

      {
        path: 'products',
        pathMatch: 'full',
        loadChildren: './products/products.module#ProductModule'
      },
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(dashboardRoutes)],
  exports: [RouterModule]
})
我的产品路线:

const productRoutes: Routes = [
  {
    path: '',
    component: ProductListComponent,
    children: [
      {
        path: ':id',
        component: ProductEditComponent
      },
      {
        path: 'addproduct',
        component: ProductCreateComponent
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(productRoutes)],
  exports: [RouterModule]
})

当我访问localhost:4200/dashboard/products/id3时,会出现一个错误:无法匹配任何路由“dashboard/products/id3”。我想我在布线设置中的某些地方出错了,但我找不到哪里有错误。有人能帮我吗

我已经为您创建了一个页面。只需检查并进行相应的更改。您需要正确检查模块路径,否则它应该可以正常工作。您可以将url更改为hello

https://stackblitz.com/edit/angular-lazy-loading-nweyjt

// For eg.
// https://stackblitz.com/edit/angular-lazy-loading-nweyjt/hello/3

sr,它仍然不起作用: