I've been struggling with a problem in angularjs
for several hours now.
Here's the pseudo code I'm working with:
doSomething(param){
var res;
if(param = "ok"){
//perform some api calls with promises
res = promise result
}
doSomeStuff(){
//if res variable is set, continue here...
// else
//if res is not set, do something else...
}
My question is: How can I achieve this functionality?
The doSomeStuff
function needs to be aware of whether the res
variable has been set or not. It should either wait for it or proceed accordingly if not set.