Doesn't matter whether I am posting or deleting etc.. I would write this:
$http({
method: ''
url: '',
data: '',
headers: ''
}).success(function(data, status, headers, config) {
//whatever happens on success
}).error(function(data, status, headers, config) {
//whatever happens on failure
});
what is the difference between doing the above or doing this:
$http({
method: ''
url: '',
data: '',
headers: ''
}).then(function(response) {
//success
},
function(response) {
//failed
};
Does one have advantages over the other? Did one come about later and there isn't much of a difference? Just want to know the differences really and what people prefer to use and why.