Refer to “link.path” while redirecting to root using [routerLink]

前端 未结 1 1821
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-28 04:03

I have an application that uses a typescript file for setting up links and within the template I use ngFor to interpolate through the links and build a navigation b

相关标签:
1条回答
  • 2021-01-28 04:27

    In Angular you can compose URL with respect of any path; [routerLink] provide the facility to provide string token or variables to make final path

    [routerLink]="['/', var, 'str']" = /var/str

    <a class="nav-link" [routerLink]='["/", link.path]'>{{ link.text }}</a>
    

    Angular official reference for RouterLink : https://angular.io/api/router/RouterLink

    0 讨论(0)
提交回复
热议问题