Can anybody show me how to set up a call-back function between a component and a service? I apologize for my lack of experience with Angular and TypeScript.
getDiscount(){
let getDisc = [];
getDisc.push({
price: Number(this.commonService.getPayments$.getValue())
});
this.commonService._getGlobalDiskaun(getDisc[0])
setTimeout(() => this.getResult(),1000);
}
I've been attempting to implement the code above, but I keep getting null results when the network is slow. How can I write a code that waits for
this.commonService._getGlobalDiskaun(getDisc[0])
to return a value before calling this.getResult()
?