Vinz243
Vinz243

Reputation: 9938

Scrolling is very unstable in ngInfiniteScroll

I have an angular app with ng-infinite scroll. The problem are:

Here is a screencast: https://i.sstatic.net/NbFSB.jpg

Now guys, this is a part of the code (the view that contains post list)

 <div infinite-scroll="loadMorePosts()" infinite-scroll-distance="0">


    <md-card ng-repeat="post in posts">
      <h5 ng-bind-html="post.title"></h5>
      <p ng-bind-html="post.body">
      </p>
    </md-card>
  <div layout="horizontal" layout-align="center">


    <md-progress-circular mode="indeterminate" ng-if="more"></md-progress-circular>

  </div>


</div>

If you want more, feel free to check source code

Upvotes: 0

Views: 872

Answers (1)

Guilhem Soulas
Guilhem Soulas

Reputation: 1995

I've been using ngInfiniteScroll for quite a while and it works fine with me.

I'm pretty sure that there is something wrong with your code.

Make sure that your update function is called only once by using some kind of lock system. Here is an example:

if ($scope.loaderBusy) {
  return;
}

$scope.loaderBusy = true;

User
.getList()
.then(function(response) {
  $scope.userList = response;
})
.finally(function() {
  $scope.loaderBusy = false;
});

Also the attribute infinite-scroll-distance="0" is not necessary.

Upvotes: 1

Related Questions