Angular: conditional class with *ngClass

后端 未结 19 2225
醉话见心
醉话见心 2020-11-22 05:21

What is wrong with my Angular code? I am getting:

Cannot read property \'remove\' of undefined at BrowserDomAdapter.removeClass ...

19条回答
  •  日久生厌
    2020-11-22 05:47

    You can use [ngClass] or [class.classname], both will work the same.
    [class.my-class]="step==='step1'"

       OR

    [ngClass]="{'my-class': step=='step1'}"

    Both will work the same!

提交回复
热议问题