After you start using observables, you will have to work in a chain of methods with observables. In your case, you can do something like this:
function InnerFunc(){
return this.menuDataService.getMenu()
.map(res => {
if(res.mainMenus == 1){
return true;
}
else{
return false;
}
)
}
function OuterFunc() {
InnerFunc()
.subscribe(result =>{
console.log(result);
});
}
source
share