我正在尝试在新闻应用程序上添加分页,但是当我向下滚动时,只能找到对象。
Ts文件:
doInfinite(infiniteScroll) {
console.log('Begin async operation');
setTimeout(() => {
this.api.getPosts().subscribe(data=>{
console.log(data)
this.getData = data
})
console.log('Async operation has ended');
infiniteScroll.complete();
}, 500);
}
HTML部分:
<ion-list>
<ion-item *ngFor="let i of getData">{{i}}</ion-item>
</ion-list>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
我希望页面向下滚动时继续加载内容
答案 0 :(得分:0)
doInfinite(infiniteScroll: any) {
//Do here your API call with pagination param
infiniteScroll.complete()
}