【问题标题】:Setting up nested/child route in Angular 2 router在 Angular 2 路由器中设置嵌套/子路由
【发布时间】:2017-02-10 23:54:42
【问题描述】:

在 URL 中设置一些类似于 mypage/param1/1/param2/2 的嵌套路由。 1是第一个参数,2是第二个参数。应该总是有两个参数,否则应该有错误。这还不适合我。我在正确的轨道上吗?

   {
        path: 'param1/:param1',
        component: PageNotFoundComponent,
        children: [
          { path: 'param2/:param2', component: SomeComponent },
        ]
    }

【问题讨论】:

    标签: angular typescript routing


    【解决方案1】:

    这行得通:

      {
        path: 'param1/:param1',
        children: [
          { path: 'param2/:param2', component: SomeComponent },
        ]
      }
    

    只有一个组件可以处理这两个变量。如果您为 'group/:groupID' 定义组件,则会发生错误。

    【讨论】:

      猜你喜欢
      • 2016-09-09
      • 1970-01-01
      • 1970-01-01
      • 2015-08-01
      • 2016-09-14
      • 1970-01-01
      • 2019-01-12
      • 2017-07-04
      • 1970-01-01
      相关资源
      最近更新 更多