Conditionally add RouterLink or other attribute directives to an element in Angular 2

后端 未结 5 998
孤独总比滥情好
孤独总比滥情好 2020-12-29 18:15

In Angular 2 if I have an element like how can I conditionally add an attribute directive like [routerLink]=\"[\'SomeRoute\'

5条回答
  •  被撕碎了的回忆
    2020-12-29 18:36

    As far as I know, there is no straight way to do this. There are some workarounds... I used something like this:

    
    
    

    There is an similar discussion here: link

提交回复
热议问题