1
我正在寻找一种通过使用名称(如Angular UI Router)来导航到我的应用程序路由的方式。Angular2路由器:通过路由名称而不是网址模式导航
例如:
const routes = [ { path: '/detail/:id', name: 'userDetail', component: DetailComponent } ]
<a [routerLink]=['userDetail', {id: user.id}]>Detail</a>
代替:
<a [routerLink]=['/detail', user.id]>Detail</a>
以这种方式,如果我想的路径从/细节改变/: ID到/用户/:ID,我只需要编辑我的路由配置文件,而不是编辑所有包含我的详细路线链接的模板。
可能吗?
感谢, 五
你能更明确的PLZ? – vincentperaud
对不起,“acquistion”是我的app.router中定义的路由,有些值只是查询字符串 – Surreal