我尝试如图所示在应用程序中显示“总价值”
https://i.imgur.com/ZXxNLHJ.jpg
itemsRef: AngularFireList<any>;
items: Observable<any[]>;
constructor(public db: AngularFireDatabase) {
this.itemsRef = db.list("/shoopping-list/");
this.items = this.itemsRef.snapshotChanges().pipe(
map(changes =>
changes.map(c => ({ key: c.payload.key, ...c.payload.val() }))
));
}
html
<ion-list style="padding-bottom: 0px;">
<div>
<ion-item-sliding *ngFor="let item of items.key | async">
<ion-item>
<div item-start>{{ item.Total }}</div>
</ion-item>
</ion-item-sliding>
</div>
</ion-list>