I must solve a problem in angularjs and I'm stuck for some hours right now.
if have this pseudo code:
doSomething(param){
    var res;
    if(param = "ok"){
        //do some api calls with promise
        res = promise result
     }
    doSomeStuff(){
        //if i got res variable, continue with this...
        // else
        //if res is not set, do this...
    }
So my question is: How i can do something like this?
The doSomeStuff function needs to know, if variable res is set or not. So it needs to wait, or to continue, if the variable res is not set.
 
     
     
    