I have the following code:
getUsers() {
this.af.database.list(DB_URL)
.map((users) => {
return users.map((user) => {
user.data = this.af.database.object(DB_URL_2).take(1);
return user;
});
})
.take(1)
.subscribe((itemPrefs) => {
this.users = users;
})
}
Which returns users array, where user.data is an observable (the user information).
How I can return the data of the user as an object and not as an observable? I tried to subscribe to my user.data but it still returning the observable:
return users.map((user) => {
user.data = this.af.database.object(DB_URL_2).take(1)
.subscribe((data) => {
return data;
});
return user;
});