According to AngularJS doc, calls to $http
return the following:
Returns a promise object with the standard then
Some code examples for simple GET request. Maybe this helps understanding the difference.
Using then
:
$http.get('/someURL').then(function(response) {
var data = response.data,
status = response.status,
header = response.header,
config = response.config;
// success handler
}, function(response) {
var data = response.data,
status = response.status,
header = response.header,
config = response.config;
// error handler
});
Using success
/error
:
$http.get('/someURL').success(function(data, status, header, config) {
// success handler
}).error(function(data, status, header, config) {
// error handler
});