Update:
I'm happy to report that my alternative solution is now also functional. It seems there was a glitch in the local storage that was causing the previous issue.
Query:
I am seeking guidance on how to effectively use the combination of promise
, async
pipe, and ngfor
. Despite attempting the following implementation, I have been unable to achieve success.
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;
});
}