Demo with ng-infin-scroll : http://plnkr.co/edit/O5w0Fp
ng-infin-scroll has a different mechanism with ng-scroller . endless scrolling starts the loadMore function when the user scrolls down. You can define the loadMore function loadMore .
I created a lazyLoad filter to return only a portion of the filtered elements controlled by the counter variable. When scrolling down, counter will increase by one to return more items from the lazyLoad filter.
When the user changes the order of the parameter, counter will reset to 1.
When counter is 1 , it will load the first 30 elements.
Notes
It may have a problem if the height of document.body less than the height of the window , as this document will not be able to scroll, therefore it will not fire the scroll event. You must manually check the heights and trigger loadMoreItems accordingly.
The problem will occur during page initialization or counter reset.
I added the adjustCounter function to run after the reset counter. ng-infin-scroll will handle this when the page loads inside.
source share