You are working with an array of objects and need to apply a specific structure to every set of elements during iteration
If you want:
Each (element) to wrap around every 4 consecutive ng-repeated elements
wrap
ng-repeated-element
ng-repeated-element
ng-repeated-element
ng-repeated-element
/
wrap
ng-repeated-element
ng-repeated-element
ng-repeated-element
ng-repeated-element
/
Every 2 groups of 4 ng-repeated elements to be enclosed by the same (element)
complex
wrap
ng-repeated-element
ng-repeated-element
ng-repeated-element
ng-repeated-element
/
wrap
ng-repeated-element
ng-repeated-element
ng-repeated-element
ng-repeated-element
/
/
complex
wrap
ng-repeated-element
ng-repeated-element
ng-repeated-element
ng-repeated-element
/
wrap
ng-repeated-element
ng-repeated-element
ng-repeated-element
ng-repeated-element
/
/
Regular use of ng-repeat:
<div ng-controller="ExampleController as example" >
<div ng-repeat="ex in example.arr">
<span>{{ex.a}}</span>
<span>{{ex.b}}</span>
</div>
</div>
will display:
<div ng-controller="ExampleController as example" >
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
</div>
How can you modify the ng-repeat to achieve this output:
<div ng-controller="ExampleController as example" >
<section> <!-- wrap each set of (x) ng-repeated elements within a section -->
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
</section>
<section>
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
<div ng-repeat="ex in example.arr">
<span>a</span>
<span>b</span>
</div>
</section>
</div>