Reputation: 5725
I'd like to reference the next element is this possible within the ng-repeat directive ?
<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>
Thanks W
Upvotes: 1
Views: 868
Reputation: 3967
As @PSL said - you just need to get the next index in the array you are looping:
<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>
Upvotes: 1