如何在 Angular 17 中实现部分通配符路由

问题描述 投票:0回答:1

我应该为以下所有链接加载一个通用组件

本地主机:4200/{TENANT1}/仪表板/索引

本地主机:4200/{租户2}/仪表板/索引

我正在尝试以下通配符路由逻辑,但它不起作用。

  {
    path: '**',
    children: [
      {
        path: 'Dashboard/Index', component: DashboardComponent
      },
    ],
  },

我也尝试了以下方法,但也不起作用

  { path: '**/Dashboard/Index', pathMatch: 'full', component: DashboardComponent },
angular angular-routing
1个回答
0
投票

尝试将租户设置为路由参数

{
    path: ':tenant',
    children: [
      {
        path: 'Dashboard/Index', component: DashboardComponent
      },
    ],
  },
© www.soinside.com 2019 - 2024. All rights reserved.