* ng用于获取特定数字的索引

时间:2019-03-06 16:12:08

标签: angular ionic4

我在data json url中有100个数组。我只想显示7到20之间的数据数组。 我做到了,但他没有工作

  <tr  *ngFor="let item of weather.hourly_forecast ; let i=index" >

    <td *ngIf="i>20" style="font-weight: bold;">{{item.mslp.metric}}</td>

1 个答案:

答案 0 :(得分:1)

您可以使用&&运算符, <td *ngIf="i>7 && i<20" style="font-weight: bold;">{{item.mslp.metric}}</td>