Is there a better way to achieve this (getting all users with their photos) :
this.authHttp.get(this.ApiUrl+'users')
.map(res => res.json())
.subscribe(users => {
for (let user of users) {
this.authHttp.get(this.ApiUrl+'users/'+user.id+'/photos')
.map(res => res.json())
.subscribe(photos => {
user['photos'] = photos;
this.items.push(user);
})
}
});
Maybe using mergeMap ?
Thank you for your advice
Julien
MergeMapis a good idea here