$第一ngRepeat [英] $first in ngRepeat
问题描述
我有一个数组 $ scope.items
。
我想,如果该项目是的 $第一个单> ngRepeat 添加CSS类在
。
有什么事情可以用角做什么?一般来说,我怎么可以处理布尔在AJS?
< DIV NG重复=项中的项目>
< DIV CLASS =''> {{item.title}}< / DIV>
< / DIV>
这应该是
< DIV NG重复=项中的项目>
< DIV纳克级='{在:$第一}'> {{item.title}}< / DIV>
< / DIV>
看纳克级
指令<一个href=\"http://docs.angularjs.org/api/ng.directive:ngClass\">http://docs.angularjs.org/api/ng.directive:ngClass而这SO THEAD <一个href=\"http://stackoverflow.com/questions/7792652/what-is-the-best-way-to-conditionally-apply-a-class-with-angularjs\">What是有条件地适用于一类angularjs的最佳方式?
I have an array $scope.items
.
I want if the item is the $first
one of the ngRepeat to add the css class in
.
Is it something that can be done with angular? Generally how can I handle the booleans in Ajs?
<div ng-repeat="item in items">
<div class='' > {{item.title}}</div>
</div>
It should be
<div ng-repeat="item in items">
<div ng-class='{in:$first}' > {{item.title}}</div>
</div>
Look at ng-class
directive http://docs.angularjs.org/api/ng.directive:ngClass and this SO thead What is the best way to conditionally apply a class with angularjs?
这篇关于$第一ngRepeat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!