The AngularJS documentation has a Deprecation Notice for the $http
success
and error
methods. Is there a specific reason this abstraction was removed from the library?
相关问题
- angularJS: ui-router equivalent to $location.searc
- Separate AngularJS Controllers Into Separate Files
- Angular ngAnimate not working first time on page l
- Ionic Spinner not showing up
- Upload file to Google Cloud Storage using AngularJ
相关文章
- Passing variable through URL with angular js
- Watch entire object (deep watch) with AngularJS
- Angular ng-if change span text
- Can ng-show directive be used with a delay
- AngularJS $routeParams vs $stateParams
- Multiple parameters in AngularJS $resource GET
- How to set class/style of accordion heading in Ang
- PUT to S3 with presigned url gives 403 error
The pattern that javascript it using related to promises is only with
.then(successCallback, errorCallback)
, so they are probably aiming to use js pattern.The problem was that
.success
and.error
methods are not chainable because they ignore return values. This caused problems for people familiar with chaining and encouraged poor code from people unfamiliar with chaining. Witness all the examples on StackOverflow that use the deferred anti-pattern.To quote one of the AngularJS team:
UPDATE
The deprecated
.success
and.error
methods have been removed from AngularJS 1.6.