dimanche 22 février 2015

$q: default reject handler


I want to return a $q instance so that if clients don't call 'then' with a reject handler, then a default one runs.


E.g. assume the default is to alert(1)


Then mypromise.then(function(result){...}) will alert 1 but mypromise.then(null, function(reason){alert(2)}) will alert 2





Aucun commentaire:

Enregistrer un commentaire