error
error

Reputation: 946

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

Upvotes: 1

Views: 490

Answers (1)

Wandrille
Wandrille

Reputation: 6821

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.

Upvotes: 4

Related Questions