Reputation: 33
Now I use :
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
to bring out all elements. But I need to bring out 4div elements. Like this:
<div>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
</div>
How could I do that with ngFor? I have a slider, and I need to show 4 elements at start.
Upvotes: 2
Views: 1089
Reputation: 50633
Use SlicePipe
:
<app ngxSlickItem *ngFor="let item of items | slice:0:4" [item]="item"></app>
First argument is start
, second argument is end
.
Read more about SlicePipe
here.
Upvotes: 6