Moved code to ngInfiniteScroll.