user1935987
user1935987

Reputation: 3347

angularjs + ui.bootstrap pagination wrong total pages number

Can't comment the main post, so need to post new question.

I'm trying to implement the pagination solution from this thread, written by Scotty.NET(the top rated answer), but facing a strange issue:

My custom code is in this plunker(http://plnkr.co/edit/Mdsy2x) and explains the issue. If I set $scope.numPerPage as any number except '10' - I'm getting wrong total pages number. For example if I generate 450 todo's and set in $scope.numPerPage = 5; - I get a total of 45 pages and 225 items showed and so any number except 10 give wrong result

Upvotes: 3

Views: 4831

Answers (1)

Kosta
Kosta

Reputation: 463

you you just need to add the items-per-page attribute:

<pagination 
      total-items="todos.length" 
      items-per-page="numPerPage"
      ng-model="currentPage" 
      max-size="maxSize"
      class="pagination-sm" 
      boundary-links="true">
  </pagination>

It's default value is 10, that's why it worked well only with 10 items per page.

Upvotes: 20

Related Questions