【发布时间】:2018-05-08 17:14:43
【问题描述】:
我从带有分页的 api 获取问题列表, 我有一个按钮,它运行一个功能并获取下一页问题。 我也需要添加这个之前的 ion-item 而不是替换它 这是我的代码:
home.html:
<div *ngFor="let question of this.questions?.data">
<ion-item class="questions_div" (click)="goToConsult(question.id);">
<p text-wrap>{{question.title}}</p>
<span>{{question.created_at | jalali}}</span>
</ion-item>
</div>
现在发生的事情是它获取第二页并将其替换为第一页,我需要将其添加到第一个 ion-item 下方
home.ts=>
loadMore(currentPage){
this.nextPage = ++this.currentPage;
this.showLatestQuestions(this.nextPage);}
showLatestQuestions(currentPage){
this.questionsProvider.getLatestQuestions(currentPage)
.then(data => {
this.questions = data;
this.currentPage = this.questions.current_page;
return this.currentPage;
})
.catch(error => alert(error)); }
【问题讨论】:
标签: angular typescript ionic-framework