vellattukudy vellattukudy - 5 months ago 19
AngularJS Question

ng-change to change the td background-color if the selected value is greater than 6

Hi I have the following code, it's basically a td with select field. The list inside the select field have values range from 1-10. How can I change the background-color of the td if the selected value is greater than 6?

<td>
{%verbatim%}
<select class="form-control" ng-model="l.o_value" ng-change="getRpn(k)"
ng-options="o.rank as (o.rank+o.generic_value) for o in occ_list">
{%endverbatim%}
</select>
</td>

Answer

Hi referthis link https://plnkr.co/edit/MpHtLHgXNyrNRYnDDzed

<td ng-class="{ 'bg-red': item.code > 6 }">