Angular 中的表视图回收

6 angular angular5

我有一个返回很多记录的表。我要做的是实现表视图回收,这样一开始只显示30条记录,然后滚动时不会生成新行,而是用新记录替换相同的行。

这如何在角度中实现?我有一个带有行和列的简单表标记,我使用 *ngFor 来显示数据。

          <table class="table table-striped table-header table-condensed ">
        <thead class="table-bordered ">
          <tr>
            <th>Name</th>
            <th>Last Name</th>
            <th>Day</th>
            <th>Type</th>

          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let row of allData">
            <td>{{row.name}}</td>
            <td>{{row.lastName}}</td>
            <td>{{row.day}}</td>
            <td>{{row.type}}</td>
          </tr>
        </tbody>
      </table>
Run Code Online (Sandbox Code Playgroud)