-
-
Save uno-de-piera/a93499ea54e2830aab124f392ee89916 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.products = this.productService.products().snapshotChanges().map(productSnaps => { | |
return productSnaps.map(product => { | |
const productData = product.payload.doc.data(); | |
const productId = product.payload.doc.id; | |
return this.productService.getProductImages(productId).snapshotChanges().map(uploadSnap => { | |
let number = 0; | |
return uploadSnap.map(upload => { | |
if(number == 0) { | |
number++; | |
return upload.payload.doc.data(); | |
} | |
}) | |
}) | |
.map(uploads => { | |
return {productId, ...productData, uploads: uploads}; | |
}) | |
}) | |
}) | |
.flatMap(products => Observable.combineLatest(products)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment