This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$q constructor function creates fulfilled promise. #6427
Closed
Description
It would be nice to have $q() create a fulfilled promise like Q does. This is nice for services that return data that could be cached but you always want to return a promise.
getData: function(key) {
if(cache[key]) {
return $q(cache[key]);
} else {
return db.find(key).then(function(doc) {
cache[key] = doc;
});
}
}
I would be happy to put together a PR with this, I just don't want to go through the work if it's not going to get looked at for inclusion.