I have a table where rows are generated using AngularJS ngRpeat:
<tr ng-repeat="player in division"> <td>{{player.name}}</td> <td>{{player.score}}</td> </tr> The array looks a bit like this:
$scope.divison = [ { name: "John Doe", score: "10", goingUp : true }, { name: "Bob Marley", score: "20" } ]; Now, what if I wanted to apply ng-class to the table row based on that particular ng-repeat? I would have though this might work:
<tr ng-repeat="player in division" ng-class="'goingUp' : player.goingUp"> <td>{{player.name}}</td> <td>{{player.score}}</td> </tr> Alas this doesn't work. Probably because the ng-class doesn't sit inside that repeat element. How can I get this working though?
ngclass="(player.goingUp) ? 'goingUp' : ''"