Check out example codes for "Angular 8 ngClass If". It will help you in understanding the concepts better.

Code Example 1

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

Code Example 2

[class.my-class]="step=='step1'"

Code Example 3

[ngClass]="(step=='step1')?'my-class1':'my-class2'"

Code Example 4

[ngClass]="{1:'my-class1',2:'my-class2',3:'my-class4'}[step]"

Code Example 5

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

Learn ReactJs, React Native from akashmittal.com