Answers for "ng-class switch case"

CSS
3

Angular 8 ngClass If

[ngClass]="{'my-class': step=='step1'}"
Posted by: Guest on February-28-2020
0

add classon ng if

[ngClass]="{'my-class': step === 'step1'}"
Posted by: Guest on June-11-2020
0

conditional classes angular

<div 
  [className]="isActive ? 'active' : 'inactive'">
</div>
Posted by: Guest on October-18-2020
1

ngclass angular

<div [ngClass]="{ 
'green': number > 5,
  'red': number <= 5,
}" ></div>
//if the number is over 5, the class 'green' will be added to the div.
//if the number is below or equal 5, the class 'red' will be added to the div.
Posted by: Guest on October-12-2020

Browse Popular Code Answers by Language