Zak Zak - 3 years ago 176
HTML Question

Create new row every n items on angular4

How can I create a new bootstrap row every n items ? I tried

*ngIf="idx % 2 === 0; else templateWithoutRow
but obviously it's not working.
Any idea ?

Thanks

Answer Source

try something like that but this is not really nice:

<div *ngFor="let row of items; let i = index">
  <div *ngIf=" i % 4 === 0 " class="row">
    <div *ngFor="let item of items.slice(i,i+4)"> 
       {{item}}  
    </div>
  </div>
</div>

I haven't verified the work of the code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download