这是我用来从Firebase提取数据并在下面运行循环的代码。
loadPeople() {
return new Promise(resolve => {
this.dataProvider.getProducts().subscribe((products) => {
this.start;
this.products = products;
this.AKey = products.pop().$key;
console.log(products);
for(let person of products) {
this.people.push(person);
}
resolve(true);
});
});
}
doInfinite(infiniteScroll:any) {
console.log('doInfinite, start is currently '+this.start);
this.start+=50;
this.loadPeople().then(()=>{
infiniteScroll.complete();
});
}
}
答案 0 :(得分:0)
我没有正确使用promises。请在下方查看如何使用Firebase对promises进行分页。 https://howtofirebase.com/firebase-data-structures-pagination-96c16ffdb5ca
-3.24198 1.03606 1.14794 118 123 116 -0.0810083 -0.0129849 -0.996629