10
Hello,
I would like to clarify the difference and when to use each of the models of handling promises:
obj.promessa( parametro ).then( function ( resposta ) {
console.log("Resposta: " + resposta);
}, function ( erro ) {
console.log("Erro: " + erro);
});
and
obj.promessa( parametro ).then( function ( resposta ) {
console.log("Resposta: " + resposta);
}).catch( function ( erro ) {
console.log("Erro: " + erro);
});
Considering the obj.promessa method was something like:
promessa: function( parametro ) {
var deferred = q.defer();
if ( fun_assincrona(parametro) ) {
return deffered.resolve("sucesso");
} else {
return deferred.reject("error");
}
return deferred.promise;
}
Hugs!
Thanks! Got it! Thanks so much for the help! Hugs!
– Rafael
@Rafael is welcome. Good question!
– Sergio