【发布时间】:2018-04-18 03:40:43
【问题描述】:
更新:
我的以下解决方案也有效。我有一个local storage 损坏或类似的东西。这就是不工作的原因。
问题:
你能告诉我如何使用promise/async管道和ngfor吗?我已经尝试如下所示。但它不起作用。
html
<ion-item *ngFor="let c of contacts | async">
<ion-label fixed>c.name</ion-label>
</ion-item>
ts
contacts: Promise<Contact[]>;
constructor() {
this.getContacts()
}
getContacts() {
this.contacts = this.storage.get('contacts').then((val: Contact[]) => {
console.log('log', val);
return val;
});
}
【问题讨论】:
标签: angular typescript ionic-framework promise ionic3