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

后端 未结 5 989
孤独总比滥情好
孤独总比滥情好 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:25

    If you don't want to duplicate the element, and just want to prevent clicks depending on the condition, you could do the following:

    
    

提交回复
热议问题