I am trying to call 3 different APIs before a component loads using the Resolve.
This code below is written inside the resolve function and is returning an object with all response packaged.
Now When The component loads, before I receive the response from server.. it returns null for each of the keys in the object returned.
Please help how do I solve this kinda issue. How do I stop it from returning until the response is not received from the API.
resolve() {
this._apiFactory.getA().subscribe(response => {
responseA = response;
});
this._apiFactory.getB().subscribe( response => {
responseB = response;
});
this._apiFactory.getC().subscribe( response => {
responseC = response;
});
return {
'A': responseA ,
'B': responseb ,
'C': responseC
};
}