0
私はデータにjsonを使用しています。私がしたいことは、データがもう利用できなくなったら無限スクロールを終了する必要があるということです。 これをどのように実装できますか。イオニック3無限スクロール終了多くのデータが見つからない場合
loadData(currentCount) {
this.http.get('http://www.exapmle.com/feed.php?page=' + this.currentCount).map(res => res.json()).subscribe(data => {
this.posts1 = data;
let i = 0;
for (let v in this.posts1) {
if (i < 4) {
this.slidesdata.push(this.posts1[v]);
} else {
this.posts.push(this.posts1[v]);
}
i++;
}
});
}
doInfinite(infiniteScroll: any) {
this.currentCount = this.currentCount + 1;
this.http.get('http://www.exapmle.com/feed.php?page=' + this.currentCount).map(res => res.json()).subscribe(data => {
this.newposts1 = data;
this.newposts = this.newposts1;
for (let i in this.newposts) {
this.posts.push(this.newposts[i]);
}
infiniteScroll.complete();
});
}
私はこれらの行をマージする場合は、2ページからのデータはない負荷を行い、そして、私はそれらをマージいけない場合、私は同じ取得私が前に持っていたエラー - 予期しないトークン<0の位置のJSONで –
あなたは無限にスクロールしましたか? –
はい、動作しますが、一度データを読み込むページがなくなると、このエラーが発生します。 –