I'm sure I'm missing something obvious and basic about synchronicity, but I cannot get my head around how this is supposed to work...
$scope.foo=[];
getFoo(url) {
$scope.foo=$http.get(url).then(function (response) {
var foo = [];
//process response to get foo array. Console.log returns as expected here.
return foo;
});
}
This just seems to set $scope.foo
to the promise object. What am I missing? How do I actually use the result of the promise in the rest of my code?