Skip to content
This repository has been archived by the owner. It is now read-only.

Change totalPages watcher to avoid resetting page number before data loa... #3085

Closed
wants to merge 1 commit into from

Conversation

@synapscommerce
Copy link

synapscommerce commented Dec 10, 2014

...ds

If data is being loaded asyncronously but the page number is already known then pagination will update page number to 1 initially before ajax data comes back, and it will stay on page 1 instead of the page originally intended.

e.g. if $scope.currentPage = 2; then <pagination ng-model="currentPage" ng-change="changed" .... > will update $scope.currentPage to 1 when the view loads initially (no data = 1 page) and fire the change handler, putting the user back on page 1.

…loads

If data is being loaded asyncronously but the page number is already known then pagination will update page number to 1 initially before ajax data comes back, and it will stay on page 1 instead of the page originally intended.

e.g. if $scope.currentPage = 2; then <pagination ng-model="currentPage" ng-change="changed"  ....  ></pagination> will update $scope.currentPage to 1 when the view loads initially (no data = 1 page) and fire the change handler, putting the user back on page 1.
@wesleycho wesleycho force-pushed the angular-ui:master branch from e373941 to 2c2dba6 Mar 23, 2015
@@ -54,6 +54,8 @@ angular.module('ui.bootstrap.pagination', [])
});

$scope.$watch('totalPages', function(value) {
if(!$scope.totalPages)

This comment has been minimized.

Copy link
@wesleycho

wesleycho Apr 5, 2015

Member

Change this to

if (!value) {
  return;
}
@wesleycho wesleycho added this to the Backlog milestone Apr 5, 2015
@wesleycho
Copy link
Member

wesleycho commented Apr 5, 2015

Can you also add a unit test for this?

@ovarunendra
Copy link

ovarunendra commented May 8, 2015

+1

@wesleycho
Copy link
Member

wesleycho commented Nov 2, 2015

This should now be fixed in master via 30099a0

@wesleycho wesleycho closed this Nov 2, 2015
@synapscommerce synapscommerce deleted the synapscommerce:patch-1 branch Nov 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.