AngularJS : Use of ng-if and ng-class combination -
i have table :
<tr> <th scope="row">quantitÉ produite</th> <td>{{hoursvalues[0][0][0]}}</td> <td>{{hoursvalues[0][0][1]}}</td> <td>{{hoursvalues[0][0][2]}}</td> <td>{{hoursvalues[0][0][3]}}</td> <td>{{hoursvalues[0][0][4]}}</td> <td>{{hoursvalues[0][0][5]}}</td> <td>{{hoursvalues[0][0][6]}}</td> <td>{{hoursvalues[0][0][7]}}</td> </tr> <tr> <th scope="row">objectif quantitÉ</th> <td>{{hoursvalues[0][2][0]}}</td> <td>{{hoursvalues[0][2][1]}}</td> <td>{{hoursvalues[0][2][2]}}</td> <td>{{hoursvalues[0][2][3]}}</td> <td>{{hoursvalues[0][2][4]}}</td> <td>{{hoursvalues[0][2][5]}}</td> <td>{{hoursvalues[0][2][6]}}</td> <td>{{hoursvalues[0][2][7]}}</td> </tr>
i want compare each column of row other corresponding column, example : hoursvalues[0][0][0] && hoursvalues[0][2][0] , according comparison, want apply classes. mean, if hoursvalues[0][0][0] > hoursvalues[0][2][0], want display result in green else red.
can me ? should write in controller ?
in each td this
<td ng-class="{true:'green', false:'red'}[hoursvalues[0][0][0] > hoursvalues[0][2][0]]">
obvius change each column corresponding one. next td
<td ng-class="{true:'green', false:'red'}[hoursvalues[0][0][1] > hoursvalues[0][2][1]]">
Comments
Post a Comment