Angular2 ngFor 跳过第一个索引 [英] Angular2 ngFor skip first index

查看:30
本文介绍了Angular2 ngFor 跳过第一个索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何跳过数组中的第一个索引?

How can I skip the first index from the array?

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

推荐答案

您可以使用 切片管道.

<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.

这篇关于Angular2 ngFor 跳过第一个索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆