Using ng-repeat, I want to have the ability to "break" out of the loop to display parts of the data in different column layouts. Here is the start of the ng-repeat I have as pseudo code. I am not sure how to "chunk" out my data, other than perhaps a filer or custom directive?
var items= [1,2,3,4,5,6,7,8,9];
<div ng-repeat="item in items">
<!-- 3 columns -->
<div class="row">
<div class="item col-md-4">
{{item}}
</div>
</div>
... break out of loop after 3 items to continue looping in a new row
<!-- 2 columns -->
<div class="row">
<div class="item col-md-6">
{{item}}
</div>
</div>
... etc ....
</div>
And the html below is the output I would like to achieve:
<!-- 3 columns -->
<div class="row">
<div class="col-md-4">1</div>
<div class="col-md-4">2</div>
<div class="col-md-4">3</div>
</div>
<!-- 2 columns -->
<div class="row">
<div class="col-md-6">4</div>
<div class="col-md-6">5</div>
</div>
<!-- 1 column -->
<div class="row">
<div class="col-md-12">6</div>
</div>
<!-- 3 columns -->
<div class="row">
<div class="col-md-4">7</div>
<div class="col-md-4">8</div>
<div class="col-md-4">9</div>
</div>
I'd like to acheive this by passing in a parameter to a filter or similar. Something similar found here in the following thread. Please help! --> add bootstrap rows during ng-repeat