Angular2 ngFor skip first index

Basit picture Basit · Feb 15, 2016 · Viewed 26.2k times · Source

How can I skip the first index from the array?

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

Answer

Thierry Templier picture Thierry Templier · Feb 15, 2016

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.