Javascript 如何显示ng zorro卡阵列并将其限制为3,以及如何添加角度分页
如何将ng zorro卡的显示限制为每3张卡,并将添加分页 代码如下: home.component.html 我想做的是限制它的项目,以3卡,它将添加分页Javascript 如何显示ng zorro卡阵列并将其限制为3,以及如何添加角度分页,javascript,angular,typescript,Javascript,Angular,Typescript,如何将ng zorro卡的显示限制为每3张卡,并将添加分页 代码如下: home.component.html 我想做的是限制它的项目,以3卡,它将添加分页 如果数组超过3条记录,它将添加分页,如果只有3条记录,则不会显示分页。您应该限制NGF进行迭代,然后使用ngIf进行分页: <ng-contaier *ngFor="let item of data | slice:initValue:endValue"> .... </ng-container> &
如果数组超过3条记录,它将添加分页,如果只有3条记录,则不会显示分页。您应该限制NGF进行迭代,然后使用ngIf进行分页:
<ng-contaier *ngFor="let item of data | slice:initValue:endValue">
....
</ng-container>
<div *ngIf="data.length > 3">
<!-- pagination code define initValue and endValue here depending on your pagination!! -->
</div>
你有一个例子吗?当它大于3时,怎么样。分页如何确定卡片。例如,您有“下一步”按钮,然后该卡应该被更改。例如,如果您需要一些文档,initValue和endvalue的值是多少?
data = [
{ title: 'title1', description: 'description1' },
{ title: 'title2', description: 'description2' },
{ title: 'title3', description: 'description3' },
{ title: 'title4', description: 'description4' },
{ title: 'title5', description: 'description5' },
{ title: 'title6', description: 'description6' },
{ title: 'title7', description: 'description7' },
{ title: 'title8', description: 'description8' },
{ title: 'title9', description: 'description9' },
{ title: 'title10', description: 'description10' }
]
<ng-contaier *ngFor="let item of data | slice:initValue:endValue">
....
</ng-container>
<div *ngIf="data.length > 3">
<!-- pagination code define initValue and endValue here depending on your pagination!! -->
</div>