Use variable in style tag in angular template?

前端 未结 4 1673
野性不改
野性不改 2021-02-20 01:55

I am working on angular 5 application, and I have requirement of applying dynamic css in style tag in template. I have tried some solutions but they are not working.

app

4条回答
  •  萌比男神i
    2021-02-20 02:26

    You can use [style.customClass]=“methodInComponent()”...

    This will apply the class if the method in your component returns true.

提交回复
热议问题