I have a stuck scenario. Here are the details:
I have several components - Comp_A, Comp_B etc etc which needs to call a service to do some calculation like:
Comp(A): Service.getStatus().subscribe(
(isYesOrNo)=>{
//do some action according to Component
if(isYesOrNo) //do something
else // do something
}
Service:
function 1 : getStatus() : Observable<boolean>{
httpService.getData().map((responseOfApi)=>{
if(!responseOfApi) return false
else return showDialogAndWaitForOk()
})
}
function 2: showDialogAndWaitForOk() {
dialog.open(header, msg).afterClosed().subscribe(()=>{return false})
}
Problem: showDialogAndWaitForOk is a subscription, even if it return it will return a subscription but getStatus needs to return boolean only.
Example: https://stackblitz.com/edit/angular-3jqhhc Hint: click on hit api button - case 3 is never updated - this is the issue - I want to show dialog in case 3 and then update the case 3 text.
Any idea how to achieve that?
Thanks in advance.