角度如何处理两条具有不同参数的相似路线?

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

角度如何处理具有不同参数的两条相似路线?

例如:

const routes: Routes = [
  {
    path: '',
    component: HomeComponent
  },
  {
    path: ':username',
    component: UserComponent
  },
  {
    path: ':username2',
    component: HomeComponent2
  }
];

角度如何知道或如何告诉角度哪个参数为username,哪个参数为username2

angular routing angular2-routing angular-routing
1个回答
1
投票
{ path: 'user/:username', component: UserComponent }, { path: 'home/:username2', component: HomeComponent2 }
© www.soinside.com 2019 - 2024. All rights reserved.