Data pagination with WebAPI and AngularJS – part 2
Data pagination with WebAPI and AngularJS – part 2

Data pagination with WebAPI and AngularJS – part 2

2015, Jun 29    

Hi all! Looks like the article I wrote some time ago about data pagination with AngularJS is still getting some attention, so I decided to give it a quick update just to spicy things a little bit.

In one of my project I needed a way to run different actions before running the actual pagination, so after some thought I decided to enter the marvelous world of callbacks.

In order to make things more generic, I took advantage of what I wrote in my last post and updated the pager code adding a callback on the page links: this way we can execute a custom function every time the user clicks on one of the links of the pager.

All I had to do was to create the isolated scope and add a pointer to the callback using the ‘&’ attribute. In case you need some refreshing, here’s a nice article about how to pass data to a directive.
Finally, you can check the code here, in the demoPager directive.

Here’s the link to the project on GitHub: https://github.com/mizrael/AngularJs-Pagination

Enjoy!

Did you like this post? Then