Denis Biondic
Denis Biondic

Reputation: 8201

Ionic infinite scroll with collection repeat - scrollbar jumping back to middle issue

Having a infinite scroll (with new items loaded by remote calls) together with collection repeat and items of different size, I have an issue that after new batch of item is renedered, the scrollbar "jumps" to the middle, or to explain it other way around, it is not on the bottom where it should be (on the button but moved a bit back to accomodate for the new items).

Upvotes: 1

Views: 430

Answers (2)

abhit
abhit

Reputation: 981

solved this by setting item-render-buffer property of collection-repeat

<div collection-repeat="business in businesses" item-height="120px" item-render-buffer="10"></div>

Upvotes: 0

Denis Biondic
Denis Biondic

Reputation: 8201

The most probable issue is that

this.$scope.$broadcast('scroll.infiniteScrollComplete');

is called BEFORE the items are added to the array / rendered.

One easy way to do this is if items are added as a result of a promise, but $broadcast is done before the promise is completed.

Upvotes: 3

Related Questions