Hi everybody,
I’m using ion-infinite-scroll and ion-refresher with a list containing ion-card with one ion-img which one, everything’s just fine, exccept when it loads more elements, backing the scroll to the top position…
This is the html part:
<ion-content>
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content></ion-refresher-content>
</ion-refresher>
<ion-list [virtualScroll]="news" approxItemHeight="380px">
<ion-card *virtualItem="let item" (click)="showDetails(item)"> <!-- [virtualTrackBy]="id" -->
<ion-img [src]="item.image" width-100 blur></ion-img>
<div class="card-title">
<span>{{ item.title }}</span>
<div class="card-subtitle">
<small>{{ item.fonte }}</small>
</div>
</div>
</ion-card>
</ion-list>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content loadingText="Carregando..."></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
And the method (it’s not working with push neither concat… I think it’s not the problem):
doInfinite(event) {
this.newsService.loadMore(this.news[Object.keys(this.news).pop()].id).subscribe( newsMore => {
//this.news = this.news.concat(newsMore);
for(let i = 0; i < newsMore.length; i ++){
this.news.push(newsMore[i]);
}
event.complete();
});
}
I hope that someone help me, I didn’t find anything about this on Ionic 2