angularjs - angular ng-repeat accessing next item -


I would like to refer to the next element within the ng-repeat instructions?

& lt; Li ng-repeat = "rows in rows" & gt; If {{row.someValue}} === {{row + 1.someValue}} // Is it possible to check whether I can make any conditional comparison in the following line? & Lt; / Li & gt;

thanks w

As @PsL said - All you need is to get the next index in the index that you are looping in:

  & lt; Li ng-repeat = "Rows in Rows" & gt; {{Rows [$ index + 1]}} // This will give you the data of the next line & lt; Div ng-switch on = "rows [$ index + 1] .value" & gt; & Lt; Div ng-switch-when = "true" & gt; & Lt ;! - Shows that the next row's value is correct - & gt; & Lt; / Div & gt; & Lt; Div ng-switch-when = "false" & gt; & Lt ;! - Shows that the value of the next row is wrong - & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Li & gt;  

Comments