page=0
getAllposts() {
const url = `${this.API_URL}/getallposts?page=${this.page}`;
return this.http.get<any[]>(url);
}
getAllList() {
this.getAllposts().subscribe(data => {
this.showPosts = this.showPosts.concat(data) as PostModel[];
});
}
loadData(event) {
setTimeout(() => {
this.getAllList()
event.target.complete();
}, 2000);
this.page++
}
答案 0 :(得分:0)
请尝试使用[
代替for loop
。
cancat
答案 1 :(得分:0)