Suppose I have a list of elements like the following
items = ['AAA','BBB','CCC','DDD','EEE','FFF'];
What I am trying to do is to wrap every 2 elements in an inner-wrap div tag.
Expected output:
<div class="outer-wrap">
<div class="inner-wrap">
<p>AAA</p>
<p>BBB</p>
</div>
<div class="inner-wrap">
<p>CCC</p>
<p>DDD</p>
</div>
<div class="inner-wrap">
<p>EEE</p>
<p>FFF</p>
</div>
</dvi>
Is this feasible in the ngFor loop?
indexof the current item, it shows you how to do that in the docs. You could therefore do<wrapper><thing></thing>for even indices and<thing></thing></wrapper>for odd indices. But what if there is an odd length? Alternatively, pair up the items into another array and iterate over that. It would be helpful to actually try something, then you can be specific about the problem you're having (if you still are).