-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
I'm sorry for posting a question here. I've been trying to get an answer on Stackoverflow, but couldn't find an answer for this.
I have the following code which returns an observable with the item details for each item key:
this.list = this.af.database.list("API_URL")
.map((ItemKeys) => {
return ItemKeys.map((ItemKey) => {
return this.af.database.object(API_URL + "/" + ItemKey); //I need this as the object (not observable)
});
}).subscribe((items) => {
this.lineData = items; //A list of observables
});
The code itereates over each item key and gets the item data from another endpoint. The problem is that it retruns an observable of each item data, and I need it in an object (the observable result).
I tried to return the subscription result with the following code, but then all my items data are empty (undefined):
this.list = this.af.database.list("API_URL")
.map((ItemKeys) => {
return orderItemKeys.map((ItemKey) => {
this.af.database.object("API_URL" + "/ItemKey.$key) // So I tried to subscribe to this..
.subscribe((data) => {
return data;
});
});
}).subscribe((items) => {
this.lineData = items; // A list with undefined items
});
How I can return the item data object as an object and not as observable of an object in my case?
Metadata
Metadata
Assignees
Labels
No labels