Angular page ng-change

0

I'm using:

link

My question is the following:

<uib-pagination ng-change="test(this, name)" total-items="totalItems" ng-model="currentPage" items-per-page="itemsPerPage"></uib-pagination>

and my js

$scope.test = function(page, name) {
    alert(page + name)
};

The name comes in handy but on the page the object comes to me,

  • How can I get the page I gave him?
  • Let's suppose that in total I have 10 000 data and if I show 10 in 10 I get 100 page buttons, how can I only get 10 for example but without using the max-size since with that I could only see the 100 first records
asked by sirdaiz 02.06.2017 в 10:23
source

1 answer

0

How can I get the page I gave you?

ng-change is called after the model is modified, so you can simply do:

$scope.test = function(angularObj, name) {
    alert($scope.currentPage);
};

If for some reason you need to obtain the current page from the object you send, you can do:

$scope.test = function(angularObj, name) {
    alert(angularObj.currentPage);
};

Let's suppose that in total I have 10 000 data and if I show 10 in 10 I get 100 paging buttons, how can I only get 10 for example but without using the max-size since with that only I could see the first 100 records

You have a concept error, use max-size and start to go to the right, after you click on 10, the keypad changes and shows you from 11 to 20. If you want to see changes in EACH page that you click, rotate = true Go to the documentation that I share below and click on each example, there it is clear that it makes each option

<uib-pagination ng-change="test(this, name)" max-size="maxSizeVar" total-items="totalItems" ng-model="currentPage" items-per-page="itemsPerPage" rotate="true"></uib-pagination>

Documentation:

link

    
answered by 02.06.2017 в 12:34