So far I've used success
to Http Promises
.
Ex:
$http.get(/url).success(function(data){
console.log("Sucesso");
})
.error(function(response, status) {
console.log("erro " + status);
});
}
But today I found an example where success
can be replaced with then
:
$http.get(/url).then(function successCallback(response) {
console.log("Sucesso");
}, function errorCallback(response) {
console.log("Erro: "+response);
});
I would like to know what are the differences between these two promisses
and what are the advantages of using them.