How can I limit ngFor repeat to 10 items in Angular 2?


#1

<template *ngFor=“let item of items; let i=index” >
<ion-slide *ngIf=“i<5” >
<img [src]=“item.ItemPic”>


#2

The correct way to do so is to use a pipe in your *ngFor directive. For instance :

<Label *ngFor="let item of itemsArray|limitTo:10" [text]="item.body"></Label>

You can find suitable documentaion here