Skip to content

$http legacy promise has been deprecated #1200

@jkiimm

Description

@jkiimm

$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;
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions