Search code examples
angularjsangularjs-directivepaginationangular-filters

How to do pagination with uib-pagination directive (ui.bootstrap)


I am doing pagination with uib-pagination directive.Items are displaying properly but in the last page I'm getting problem. In the page values are getting duplicating. I don't know what exactly the problem.

 <uib-pagination class="pagination-sm pagination" total-items="filtered.length" ng-model="page"
                        ng-change="pageChanged()" previous-text="&lsaquo;" max-size="5" boundary-link-numbers="true" num-pages="numPages" next-text="&rsaquo;" items-per-page="itemsPerPage" ></uib-pagination>

http://plnkr.co/edit/plhWxXGSPPtfx1WUSw0o?p=preview


Solution

  • Finally I got the answer .Only Change in the logic.

    limitTo:itemsPerPage:itemsPerPage*(page-itemsPerPage)
    

    changed to

    limitTo:itemsPerPage:itemsPerPage*(page-1)
    

    Check in by plunker here http://plnkr.co/edit/plhWxXGSPPtfx1WUSw0o?p=preview