boutique replica bags up ideas

the best replique rolex and prices here.

julia highlight 99j hair color 10a quality straight human hair lace front wigs 8 - 24 inches pre plucked hairline 13x4 inches lace front brazilian wig onlinefor sale

Combine the results of two observable in angular

Updated on     Kisan Patel

How to combine the results of two observable in angular?

Use forkJoin to join multiple results.

// Get all posts
// Get the user of each post
// Get the todos for each user
postData$ = this.http.get<Post[]>(this.postUrl).pipe(
    switchMap(posts =>
        forkJoin(
             posts.map(post =>
                  forkJoin([
                        this.http.get<User>(`${this.userUrl}/${post.userId}`),
                        this.http.get<ToDo[]>(`${this.todoUrl}?userId=${post.userId}`)
                     ]).pipe(
                          map(([user, todos]) => ({
                                    post: post,
                                    userName: user.name,
                                    todos: todos
                          }))
                 )
             )
        )
   )
);

Angular RxJS

Leave a Reply