Conditional class with *ngClass

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

Leave a Reply

Your email address will not be published. Required fields are marked *