ionic 3 프로젝트에서 더 많은 데이터를로드하려고합니다. 무한 스크롤은 처음에만 작동합니다. 그리고 페이지가 위 아래로 스크롤 될 때까지 작동을 멈 춥니 다. 여기 이온 3 무한 스크롤은 내용이 위에서 아래로 스크롤 될 때까지 작동하지 않습니다.
내 코드HTML입니다
<ion-content>
<ion-scroll style="width:100%;height:100vh" scrollY="true">
<ion-list *ngIf="posts.length>0">
<button *ngFor="let post of posts" ion-item>
<ion-thumbnail item-start>
<img [src]="getPostImage(post)">
</ion-thumbnail>
<h2>{{ post.title.rendered }}</h2>
</button>
</ion-list>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content loadingText="Loading..."></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-scroll>
</ion-content>
doInfinite(infiniteScroll) {
this.getCategoryPosts(infiniteScroll);
}
getCategoryPosts(infiniteScroll=null){
this.api.getCategoryPosts({
id : this.topic.id,
limit : this.limit,
page:this.page,
success:(posts)=>{
this.zone.run(()=>{
if(this.page >1){
this.posts = this.posts.concat(posts);
}else{
this.posts = posts;
}
this.page++;
if(infiniteScroll!=null)
infiniteScroll.complete();
});
},
error:(error)=>{
console.log(error);
}
});
}