Conditional class with *ngClass
August 13, 2022
Single Class:
[ngClass]="{'my_class': step === 'step1'}"
Multiple Classes:
[ngClass]="{'my_class': step === 'step1', 'my_class2' : step === 'step2' }"
Details:
- my_class – CSS class.
- step – Angular model
- step1 – Boolean condition
Add block