Reputation: 1357
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.
Upvotes: 0
Views: 4141
Reputation: 1123
You can make use of ternary operators like this
<td ng-class="variable === 1 ? 'red' : variable === 2 ? 'blue' : 'green'">{{data.material_or_service}}</td>
Upvotes: 2