【问题标题】:how to use same module using different routes in angular如何在角度中使用不同的路线使用相同的模块
【发布时间】:2020-10-20 10:49:11
【问题描述】:

我正在开发一个角度应用程序,其中我们有多个使用相同模块的菜单(A、B、C、D、E)。 菜单 A、C 和 E 使用相同的组件/模块。 我的要求是当我在 A 上时,如果我在菜单上单击 C,则应加载相同的组件,并使用不同的数据。每当单击菜单项时,我都会使用来自“@ionic/angular”的 NavController 的 navigateRoot 函数进行导航。

【问题讨论】:

    标签: angular ionic-framework menu


    【解决方案1】:

    您需要创建 2 条路由,两条路由都加载相同的组件。 例如:

    const routes: Routes = [
        { path: 'edit/:id', component: EditCustomerComponent },
        { path: 'add', component: EditCustomerComponent },
    ];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多