我正在使用 AngularJS,我想要获得的效果将类似于它会产生的效果,假设它会起作用(它不会起作用)。
看法
<tr ng-repeat='person in people' ng-class='rowClass(person)'>
<td>.....info about person...</td>
<td>.....info about person...</td>
<td>.....info about person...</td>
</tr>
控制器
$scope.rowClass = function(person){
...return some value based upon some property of person...
}
我意识到这段代码不起作用,因为person
它不可用,ng-class
因为它只对每行内的对象可用。代码是为了了解我想要做的事情:即。我希望能够拥有使用ng-repeat
其类创建的表行也基于一个条件,该条件取决于对行本身的范围特性的访问,例如。person
. 我意识到我可以在列上添加 ng-class 但这很无聊。有人有更好的想法吗?