I had the following code in my project and I was hoping it worked.
var retrieveUpdates = function (hash) {
    myFunction(data)
      .then(function(filters){
        return Restangular.all('retrieveUpdates').post({ filters });
    });
};
But of course this fails because a return is happening before the then. I can "fix" it but it seems to be ugly (especially when this scenario is all over the place).
var retrieveUpdates = function (hash) {
    var defer = $q.defer();
    myFunction(data)
      .then(function(filters){
        Restangular.all('retrieveUpdates').post({ filters }).then(defer.resolve, defer.reject);
      });
    return defer.promise;
};
Is there a cleaner way to do this?
 
     
     
    