我想从保存在数组中的Firebase中获取数据。如何获取“ productcarteditem”中“金额”中的数据?
export class ViewcartdetailsComponent implements OnInit {
public alldetails: any;
public id: string;
// public replays: any;
constructor(public acivatedroute: ActivatedRoute, public firestore: FirestoredatabaseService) {
this.id = this.acivatedroute.snapshot.params['id'];
}
ngOnInit() {
this.alldetails = this.firestore.detailscart(this.id).valueChanges();
}
}
[<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6"> {{(alldetails | async)?.productcarteditem.amount}} </div>
</div>]
答案 0 :(得分:0)
分配一个变量并使用它
<div class="col-md-6" *ngIf="alldetails | async; let item">
{{item?.productcarteditem.amount}} </div>
</div>