0

I am created a AngularJs application.I need to change table row background color based on 3 condition.I know to change background color based on 2 condition using following way

<td ng-class="{'red': (variable == 1), 'blue': (variable ==2)}">{{data.material_or_service}</td>

I need to do above using three condition;that is variable==3.is any way to do it.

Shahid Neermunda
  • 1,317
  • 1
  • 14
  • 28

1 Answers1

2

You can make use of ternary operators like this

<td ng-class="variable === 1 ? 'red' : variable === 2 ? 'blue' : 'green'">{{data.material_or_service}}</td>
Tushar
  • 1,115
  • 1
  • 10
  • 26