I am using Angularfire2 v5. In my database I have two lists one is cart
and other one is product
. In cart list there is a field which contains product id and now I want a Observable
that contains data for both the cart and it's product. Currently I am trying with this way
cart: Observable<any>;
constructor(public db: AngularFireDatabase) {}
ionViewDidLoad() {
this.cart = this.db.list(`/cart`)
.snapshotChanges()
.map(changes => {
return changes.map(c => {
let productObservables:Observable<any> = this.db
.list(`product/${c.key}`).snapshotChanges()
.map(m=>{
m.map(p=>({
key:c.payload.key, ...p.payload.val()
}));
return m;
});
return productObservables;
})
});
now in html using this
<ion-item *ngFor="let item of cart|async">
<ion-label>
{{item.key}}
{{item.name}}
</ion-label>
but it shows me null. How can I display both data the cart and product list in one ngFor
async