0
Update:Versprechen und Asynchron-Rohr und Angular ngfor
Below Lösung von mir arbeitet auch. Ich hatte eine local storage
Korruption oder etwas ähnliches. Das war der Grund dafür, nicht zu arbeiten.
Frage:
Können Sie mir sagen, wie promise
/async
Rohr und ngfor
benutzen? Ich habe versucht, wie unten gezeigt. Aber es funktioniert nicht.
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;
});
}
Vielen Dank. Das funktioniert :) – Sampath