I have implemented a if statement like this
if (this.service.check() ) {
return true;
}
else {
}
this if condition waits for a response from the backend. But before the observable gets executed it's going into the else statement and finishing the condition without checking the if condition at start.
this is my observable method to get the data from backend
public check(){
this.getActorRole().subscribe(
(resp => {
if (resp == true){
return true
}
}),
(error => {
console.log(error);
})
);
}
}
So how make the condition waits until it gets the response from the backend