multiple ngclass angular 8 code example

Example 1: ngclass multiple conditions

<a [ngClass]="{'class1':array.status === 'active','class2':array.status === 'idle','class3':array.status === 'inactive',}">

Example 2: multiple ngclass

<section [ngClass]="{'class1':condition1, 'class2': condition2, 'class3':condition3}" >

Example 3: conditional classes angular

<div 
  [className]="isActive ? 'active' : 'inactive'">
</div>

Example 4: ng class multiple class names

<!-- notice expression1 used twice -->
<div ng-class="{class1 : expression1, class2 : expression1}">
    Hello World!
</div>