1

Can some one spot error with this pagination. Date in the table is not updating with change of page links

                <uib-pagination
                        ng-model="currentPage"
                        total-items="rows.length"
                        max-size="maxSize"
                        boundary-links="true">
                </uib-pagination>

http://plnkr.co/edit/1XPI7zwSrooBeAcBNddU?p=preview

5
  • You haven't posted enough code in the question itself to really understand or reproduce your problem. however, just a quick glance at your linked plunker shows that you are using a different ng-model for your pagination control than for the table. Commented Oct 20, 2015 at 6:29
  • i did not understand what you said. "different ng-model" Commented Oct 20, 2015 at 6:46
  • your pagination is using ng-model="currentPage", but your table is using ng-model="filteredRows", so the pagination control will have no effect on that table. Commented Oct 20, 2015 at 6:47
  • i have a $watch method that changes filteredrows basing on currentPage selection Commented Oct 20, 2015 at 6:49
  • I don't think you need all the watch stuff ... see my answer below. Commented Oct 20, 2015 at 6:50

1 Answer 1

5

I think you could simplify your code a little ... This should work:

HTML (just the diff):

<tr ng-repeat="reservation in rows | limitTo:numPerPage:(currentPage - 1) * numPerPage">

JS:

$scope.rows=[ ... ];
$scope.currentPage = 1;
$scope.numPerPage = 3;
$scope.maxSize = 5;
$scope.startAt = 0;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.