« Back
in javascript angularjs future promise read.

Legacy Promises in AngularJS.

Weird, angular-relative success() and error()

$http.get('https://api.github.com/users/kutyel/gists')  
.success(function(data) {
  $scope.gists = data;
})
.error(function(data, status) {
  console.error('Repos error', status, data);
})
.finally(function() {
  console.log("finally finished repos");
});

The $http legacy promise methods success and error have been deprecated. Use the standard then method instead. If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error. (v1.4.6)

Same result with standard then() and catch()

$http.get('https://api.github.com/users/kutyel/gists')  
.then(function(res) {
  $scope.gists = res.data;
})
.catch(function(err) {
  console.error('Gists error', err.status, err.data);
})
.finally(function() {
  console.log("finally finished gists");
});
comments powered by Disqus