使用ngFor循环并跳过第n个元素 [英] Looping using ngFor and skip nth element

查看:393
本文介绍了使用ngFor循环并跳过第n个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道angular2中是否有一种方法可以使用*ngFor遍历数组或列表并跳过第一个或第n个元素

I was wondering if there is a way in angular2 to loop through an array or a list using *ngFor and skip the first or nth element

推荐答案

<div *ngFor="let item of items; let i=index">
  <div *ngIf="i != n">{{i}} is not n</div>
</div>

这篇关于使用ngFor循环并跳过第n个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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