conditionally assign a css class angular 9

51

[ngClass]="{'my-class': step=='step1'}"
<div 
  [className]="isActive ? 'active' : 'inactive'">
</div>
<div [ngClass]="{'message': info.priority < 10,
                 'warn': info.priority > 10 && info.priority < 20, 
                 'error': info.priority > 30}">

{{info.text}}

</div>

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

Comments

Submit
0 Comments