Im trying to highlight a table line, but its hard to translate to angular js inside of the directive. Check the pseudo code:
if(highlight.indexOf($index) != -1) set .highlight css class
This is an example of my code:
$scope.highlight = [0,2,3]
.highlight { color: red; }
<table class="ui celled table"> <thead> <tr> <th>AAA</th> <th>BBB</th> </tr> </thead> <tbody> <tr ng-repeat="a in as track by $index"> <!-- The ng-class needs to be here, but where should i do the verification? --> <td>{{a}}</td> <td>{{b[$index]}}</td> </tr> </tbody> </table>
在ng-repeat
之后使用ng-class
:
<tr ng-repeat="a in as track by $index" ng-class="{highlight: highlight.indexOf($index) > -1}">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.