[英]How an i change the pagination-control numbers(1 2 3) to other values like 'Anything1 Anything2 …' using ngFor* on array in ngx-pagination?
Is it possible to replace ngx-pagination's 'pagination-control'?是否可以替换 ngx-pagination 的“分页控制”? By defaults, page numbers are showing like '1 2 3'.
默认情况下,页码显示为“1 2 3”。 And I want to replace them with a string value in the array.
我想用数组中的字符串值替换它们。
<pagination-controls (pageChange)="pageChange($event)" class="my-pagination"></pagination-controls>
The above code will display pagination numbers like上面的代码将显示分页数,如
I want to replace the number with values from an array [Anything1, Anything2, Anything3].我想用数组 [Anything1,Anything2,Anything3] 中的值替换数字。 Here my data is fixed and I know my page number count and its details.
在这里,我的数据是固定的,我知道我的页码计数及其详细信息。
You need to have look at custom template of ngx-pagination.您需要查看 ngx-pagination 的自定义模板。 In customization part you may try to add your
Anything
before {{page.label}}
.在自定义部分,您可以尝试在
{{page.label}}
之前添加您的Anything
。
Custom Template example can be found here.自定义模板示例可以在这里找到。 http://michaelbromley.github.io/ngx-pagination/#/custom-template
http://michaelbromley.github.io/ngx-pagination/#/custom-template
<pagination-template #p="paginationApi"
[id]="config.id"
(pageChange)="config.currentPage = $event">
<div class="custom-pagination">
<div class="pagination-previous" [class.disabled]="p.isFirstPage()">
<a *ngIf="!p.isFirstPage()" (click)="p.previous()"> < </a>
</div>
<div *ngFor="let page of p.pages" [class.current]="p.getCurrent() === page.value">
<a (click)="p.setCurrent(page.value)" *ngIf="p.getCurrent() !== page.value">
<span>Anything{{ page.label }}</span>
</a>
<div *ngIf="p.getCurrent() === page.value">
<span>Anything{{ page.label }}</span>
</div>
</div>
<div class="pagination-next" [class.disabled]="p.isLastPage()">
<a *ngIf="!p.isLastPage()" (click)="p.next()"> > </a>
</div>
</div>
</pagination-template>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.