[英]How to hide last page number in Angular pagination?
I want to customise my pagination in angular, it should look something like this:我想以角度自定义我的分页,它应该看起来像这样:
<< < 1 2 3... > >> << < 1 2 3... > >>
<< <... 7 8 9... > >> << <... 7 8 9... > >>
Is there any way to achieve this?有什么办法可以做到这一点? I am using ngx-pagination but it is showing the last page number which I don't want.
我正在使用 ngx-pagination 但它显示了我不想要的最后页码。 Please help.
请帮忙。
Current scenario:当前场景:
< 1 2 3... 20 > < 1 2 3... 20 >
Want this: << < 1 2 3... > >>想要这个: << < 1 2 3... > >>
This could be achieved via custom-template.这可以通过自定义模板来实现。 Here in the official docs example: http://michaelbromley.github.io/ngx-pagination/#/custom-template
在官方文档示例中:http: //michaelbromley.github.io/ngx-pagination/#/custom-template
Here in the template, it loops thru the pages
array.在模板中,它循环遍历
pages
数组。
<div *ngFor="let page of p.pages"
Since we don't want the last page, just cut it out of the array由于我们不想要最后一页,只需将其从数组中切出即可
<div *ngFor="let page of p.pages | slice: 0:p.maxSize - 1"
Full working code could be found here: https://stackblitz.com/edit/angular-xtusj7?file=app/app.component.ts完整的工作代码可以在这里找到: https ://stackblitz.com/edit/angular-xtusj7?file=app/app.component.ts
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.