<p class="{{condition ? 'checked' : 'unchecked'}}">
<!-- or -->
<p [ngClass]="condition ? 'checked' : 'unchecked'">
<!--or -->
<p [ngClass]="[condition ? 'checked' : 'unchecked']">
[ngClass]="{'my-class': step === 'step1'}"
[ngClass]="{'my-class': step=='step1'}"
[ngClass]="(step=='step1')?'my-class1':'my-class2'"
[ngClass]="(step=='step1')?'my-class1':'my-class2'"
<div
[className]="isActive ? 'active' : 'inactive'">
</div>
[class.my-class]="step === 'step1'"
[ngClass]="{'my-class': step=='step1', 'my-class2':step=='step2' }"
[ngClass]="{'my-class': step === 'step1', 'my-class2':step === 'step2' }"
[ngClass]="{'myclass1': match === 'match1'}"
[ngClass]="{'myclass2': match === 'match1', 'myclass2' : match === 'match2' }"
[ngClass]="{1:'my-class1',2:'my-class2',3:'my-class4'}[step]"
<button [class.disable]="1==1">Apply disable class when condition is true</button>
<p [ngClass]="{'red':false, 'green':true}">
Sure you understand Angular Directives!
</p>
<style>
.red{color: red}
.green{color: green}
</style>
[class.my-class]="step=='step1'"