I have an array of items elements.
I would like to use the ng-repeat directive or something similar, group n elements together. For instance:
I would like items=['a', 'b', 'c', 'd', 'e', 'f', 'g'] be displayed in groups of 3, which will display as:
<div class="row"> <div class="col-sm-4">a</div> <div class="col-sm-4">b</div> <div class="col-sm-4">c</div> </div> <div class="row"> <div class="col-sm-4">d</div> <div class="col-sm-4">e</div> <div class="col-sm-4">f</div> </div> <div class="row"> <div class="col-sm-4">g</div> </div>
I know I could do some processing to turn items into items=[['a', 'b', 'c'], ['d', 'e', 'f'], ['g']] , however, I was wondering if anuglarjs supports circumventing this. Does it have? If not, how would you do it?
Thanks in advance.
source share