I don't think I understand how http and javascript work because I have this method,
$scope.myfunc= function (arg) {
var flag = false;
$http.get('/someurl/' + arg).
success(function (data) {
if(check(data))
flag = true;
console.log("i want this first");
})
}
console.log("i want this second");
return flag;
};
and the order in which things are done are not how I want them.
"i want this second" app.js:109
GET {some console stuff}
"i want this first"
I'm calling this thru another method where I check the json and do something based on what the data looks like, ie the flag. How can I have the http stuff do its thing before returning my flag variable.