Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dirPagination: how to match the data with the pagenum by using the promise? #442

Open
DAIGOR1024 opened this issue Mar 7, 2017 · 0 comments

Comments

@DAIGOR1024
Copy link

Hi!Thanks for your nice lib

Here is my question
I am tesing the dirPagination with AngularJS 1.5.8 and using the promise to get the server-side data
every time I call the function,it will return the 10 objects and the totalnum of all data just like below:

{
    total : 59,
    data: [
        { // item 1... },
        { // item 2... },
        { // item 3... },
        ...
        { // item10... }
    ]
}

and my function in my controller like below:(call this function once,it return 10results and the totalnum at a time)

function getData(){
       var promise = Service.get($scope.term);
             promise.then(function(result) {
             $scope.totalItems = result.total
              var ii = 0
              for (; ii < result.data.length; ii++) {
                    $scope.results.push(result.data[ii]);
              }
      });
}

like the example above,total 59 objects,it will make 59/10 = 6 pagination links.
but how can I match every 10 objects with each pagination link?
I don't get all the data at once.
how to show the correct data which have been matched with?
how to set up a $watch with the code above?
any ideas?
Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant