I use a method that expects a promise. Sometimes however, the promise
is resolved instantly. Currently, if the promise
is resolved right away, I still pass the promise, and use the following:
function instantAction()
{
var defer = $q.defer();
// Actions that are performed instantly
defer.resolve();
return defer.promise;
}
If there a way, to just return the resolve directly, such as something along the lines of return $q.resolve()
and skip those two extra lines?