Using success/error/finally/catch with Promises in AngularJS
I'm using $http in AngularJs, and I'm not sure on how to use the returned promise and to handle errors. I have this code: $http .get(url) .success(function(data) { // Handle data }) .error(function(data, status) { // Handle HTTP error }) .finally(function() { // Execute logic independent of success/error }) .catch(function(error) { // Catch and handle exceptions from success/error/finally functions }); Is this a good way to do it, or is there an easier way? Promises are an abstraction over statements that allow us to express ourselves synchronously with asynchronous code. They represent a