I had this problem looping over an array possibly larger than 10 items. But I only had to show 10. This snippet solves this problem.


The solution is to use a slice pipe, which is built-in in the CommonModule:

<ion-item class="flex flex-row" *ngFor="let favorite of favorites| slice:0:10;" routerLink="/detail" [queryParams]="{Id: favorite.id}">
      <ion-badge >{{favorite.title}}</ion-badge>



Saved you some valuable time?

Buy me a drink 🍺