我想在ng-repeat指令中引用下一个元素吗?
<li ng-repeat="row in rows">
if {{row.someValue}} === {{row+1.someValue}}
//Is it poss to check if the following row so I can do some kind of conditional comparison ?
</li>
由于 w ^
答案 0 :(得分:0)
正如@PSL所说 - 你只需要在循环的数组中获取下一个索引:
<li ng-repeat="row in rows">
{{rows[$index+1]}} // this will give you the next row's data
<div ng-switch on="rows[$index+1].value">
<div ng-switch-when="true">
<!-- shows when the value of the next row is true-->
</div>
<div ng-switch-when="false">
<!-- shows when the value of the next row is false-->
</div>
</div>
</li>