I'm currently learning Angular and struggling with a seemingly simple issue. My goal is to achieve the following HTML structure in AngularJS:
<div>
<div>
{{bar[i]}}
{{bar[i+1]}}
</div>
<div>
{{bar[i+2]}}
{{bar[i+3]}}
</div>
</div>
My attempt involves iterating over my model using ng-repeat
in this manner:
<div ng-repeat="bar in bars">
<div>
<div ng-include="bar.html"></div>
<div ng-include="bar.html"></div>
</div>
</div>
The problem arises from both ng-include
referencing the same variable bar
.
Is there a way to access elements at index i
and
i+1</code within a <code>ng-repeat
loop?
Any help would be appreciated!