Reputation: 3927
I have this codepen, and using the function '$scope.pageChanged'
to see when a page is changed.
$scope.pageChanged = function() {
$log.log('Page changed to: ' + $scope.currentPage);
};
But when I click on page links (changing a page), the variable '$scope.currentPage'
doesn't changes. Why?
I think is something about the filter
, but not sure.
Upvotes: 3
Views: 2936
Reputation: 28289
Change
$scope.currentPage = 1;
to
$scope.pagination = {
currentPage: 1
};
And as a consequence, it should be:
... pagination: pagination.currentPage
... ng-model="pagination.currentPage"
... $log.log('Page changed to: ' + $scope.pagination.currentPage);
You can group also other variables like maxSize
in pagination
. Avoid to bind primitives directly to the $scope
.
Upvotes: 10