I'm looking for a way to navigate to the routes of my application by using names, like Angular UI Router does.
For example :
const routes = [ { path: '/detail/:id', name: 'userDetail', component: DetailComponent } ]
<a [routerLink]=['userDetail', {id: user.id}]>Detail</a>
instead of :
<a [routerLink]=['/detail', user.id]>Detail</a>
In that way if I'd like to change the path from /detail/:id to /user/:id, I only would have to edit my routing configuration file, instead of editing all templates containing the link to my detail route.
Is it possible ?
Thanks, V.
这就是我在角度4中实现它的方法,我认为它在2中的工作方式相同。
<button class='button' routerLink='"acquisition" + {{someValue}}'>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.