-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Milestone
Description
$http Deprecation Notice tell us .success
and .error
method which we have been using have become legacies. This commit is related with this issue. Therefore, I think we have to follow that.
If you take a look $http General Usage, then get to know response object has changed a little. While .success
and .error
callback was returning just response body by default, .then
is returning object with some useful properties. A callback response that we have got from .success
and .error
is data
property that a callback response have in .then
.
// in success
$http.get('/api/things').success(function(awesomeThings) {
$scope.awesomeThings = awesomeThings;
});
// in then
$http.get('/api/things').then(function(res) {
$scope.awesomeThings = res.data;
});