Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 ngFor skip first index [duplicate]

How can I skip the first index from the array?

<li *ngFor="#user of users">
    {{ user.name }} is {{ user.age }} years old.
  </li>
like image 705
Basit Avatar asked Feb 15 '16 09:02

Basit


2 Answers

You could use the slice pipe.

<li *ngFor="#user of users | slice:1">
  {{ user.name }} is {{ user.age }} years old.
</li>

The first parameter corresponds to a positive integer representing the start index.

like image 156
Thierry Templier Avatar answered Nov 11 '22 19:11

Thierry Templier


There is the SlicePipe for this use case:

  <li *ngFor="let user of users | slice:1">
    {{ user.name }} is {{ user.age }} years old.
  </li>
like image 21
Günter Zöchbauer Avatar answered Nov 11 '22 17:11

Günter Zöchbauer