Apply a directive conditionally

前端 未结 15 1971
别跟我提以往
别跟我提以往 2020-11-27 15:11

I am using Material 2 to add md-raised-button. I want to apply this directive only if certain condition becomes true.

For example:

<         


        
15条回答
  •  不知归路
    2020-11-27 15:38

    Currently, there is NO way to conditionally apply a directive to a component.This is not supported.The components which you have created can be added or removed conditionally.

    There is already an issue created for the same with angular2, so it should be the case with angular4 aswell.

    Alternatively you can go for the option with ng-if

    
     
    

提交回复
热议问题