0
我创建了一个提示警报,我希望它保存,然后按反向时间顺序填充列表。Ionic V2提示警报到填充列表
我没有收到任何错误,我只是在点击“保存”后才看到列表中的项目。
这里是我的代码:
public add() {
let alert = this.alertCtrl.create({
title: "Add Date & Time",
message: "Enter the date and time of your donation.",
inputs: [
{
name: "donation",
placeholder: "DD/MM/YYYY"
},
{
name: "time",
placeholder: "HH:MM AM/PM"
}
],
buttons: [
{
text: "Cancel"
},
{
text: "Save",
handler: data => {
this.donationList.push({
name: data.donation,
time: data.time
});
}
}
]
});
alert.present();
}
而且这里是我的html代码:
<ion-content>
<ion-list>
<ion-item *ngFor="let donation of donationHistoryList">
{{donation.name}}
<ion-note item-right>
{{donation.time}}
</ion-note>
</ion-item>
</ion-list>
</ion-content>