[英]limit pagination in angular4
I try apply pagination in angular4 but I don't khnow how to apply limit in pagination .. limit : for example I have 1000 pagination how to display in the first 5 pagination then ... then last page : 1 2 3 4 5 .... 1000. in my code I display all pagination 1000 pagination but isn't not good design for client: 我尝试在angular4中应用分页,但是我不知道如何在分页中应用限制。限制:例如,我有1000个分页,在前5个分页中如何显示,然后在最后一页中显示:1 2 3 4 5。 ...1000。在我的代码中,我显示所有的分页1000的分页,但对客户而言并不是很好的设计:
code component: 代码部分:
addClass(x)
{
$(".page-item").click(function () {
$(this).addClass("current").siblings().removeClass('current');
});
}
next()
{
$('.current').next('.page-item').trigger('click');
}
previous()
{
$('.current').prev('.page-item').trigger('click');
}
code html: 代码html:
<ul>
<li class="previous" (click)="previous()">Previous</li>
<li class="next" (click)="next()">Next</li>
</ul>
<ul class="pagination">
<li *ngFor="let x of pages" class='page-item' (click)='addClass(x)'>
{{x}}
</li>
and this is screenshot of display in my page: 这是我页面中显示的屏幕截图:
Some hint: 一些提示:
You can try ngx-pagination v3.1.0 您可以尝试ngx-pagination v3.1.0
https://github.com/michaelbromley/ngx-pagination https://github.com/michaelbromley/ngx-pagination
https://stackblitz.com/edit/angular-e1f9hq https://stackblitz.com/edit/angular-e1f9hq
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.