How do I get deferre.resolve from a function?
my controller calls this:
service.getData().then(function(response){
in service:
var _getData = function (){
$http.get(url).success(function(response){
deferred.resolve(_myFunc(response.Message));
});
return deferred.promise;
}
and myFunc also:
$http.get(url).success(function(response){
deferred.resolve(response);
});
return deferred.promise;
so I need to defer the myFunc solution, which is called in another func, which is called in my controller .. and displays it there
EDIT
I returned the deferred forecast. BUT it returns ONLY the first promise of the SERVICE function, not myFunc, and I need the promise myFunc
EDIT 2
Look also at Carson Drake's answer, this is not an anti-pattern!
source
share