尝试对基于 div 类或每个 div 的任何唯一标识符的分页。因此,我使用了 ngx-pagination,但它不起作用,只有当我们使用 ngFor 时它才起作用,但它应该在没有 ngFor 的情况下起作用,但它不起作用。那么该怎么做呢?
app.component.html:
<div class="file">
<p>"userId" = 1</p>
<p>"id" = 97</p>
<p>"title" = dolorum laboriosam eos qui iure aliquam</p>
<p>"completed" = false</p>
<hr>
</div>
<div class="file">
<p>"userId" = 2</p>
<p>"id" = 97</p>
<p>"title" = dolorum laboriosam eos qui iure aliquam</p>
<p>"completed" = false</p>
<hr>
</div>
<div class="file">
<p>"userId" = 3</p>
<p>"id" = 97</p>
<p>"title" = dolorum laboriosam eos qui iure aliquam</p>
<p>"completed" = false</p>
<hr>
</div>
<div class="file">
<p>"userId" = 4</p>
<p>"id" = 97</p>
<p>"title" = dolorum laboriosam eos qui iure aliquam</p>
<p>"completed" = false</p>
<hr>
</div>
<pagination-controls (pageChange)="p = $event" class="float-right"></pagination-controls>
演示:https ://stackblitz.com/edit/angular-simple-pagination-vsajsa?file=src%2Fapp%2Fapp.component.html