According to AngularJS doc, calls to $http
return the following:
Returns a promise object with the standard then method and two http specific methods: success and error. The then method takes two arguments a success and an error callback which will be called with a response object. The success and error methods take a single argument - a function that will be called when the request succeeds or fails respectively. The arguments passed into these functions are destructured representation of the response object passed into the then method.
Aside from the fact that the response
object is destructured in one case, I don't get the difference between
- the success/error callbacks passed to be passed as arguments of
promise.then
- the callbacks passed as arguments for the
promise.success
/promise.error
methods of the promise
Is there any? What's the point of these two different ways to pass seemingly identical callbacks?