I get two responses below for each of observable when resolved (subscriptions) in our app -
obs1$.subscribe(x=>{
Response1 = x;
});
obs2$.subscribe(y=>{
Response2 = y;
});
Response1 = [{id: 1, qty: 0, description: "product1"},
{id: 2, qty: 0, description: "product2"},
{id: 3, qty: 0, description: "product3"}]
Response2 = [{id: 1, qty: 23, description: "product1"},
{id: 3, qty: 10, description: "product3"}]
I am using RxJS Observables and fairly new to it. I need to merge both responses and update the qty (value should be from Response2 only) based on common ids of both responses. The final response should look like -
FinalResponse = [{id: 1, qty: 23, description: "product1"},
{id: 2, qty: 0, description: "product2"},
{id: 3, qty: 10, description: "product3"}]
How can I do this using RxJS Observables ?