myCallback()
will be executed once the response is received and console.log(scope.mediafiles)
returns undefined
.
I need to display scope.mediafiles
.
foo = function(callback) {
$http(method: "get", url: "http://myhost/bananas", options = {}).success(callback)}
myCallback = function(result) {
scope.mediafiles = result
console.log(scope.mediafiles) // it will output the result
}
foo(myCallback);
console.log(scope.mediafiles) // output undefined
@AlekseySolovey Even if I read the documentation, I still do not understand.
mydata.then(function(res){scope.mediafiles = res;});
returns
Thanks a lot for your Support!