小编san*_*tro的帖子

Angularjs - $ http成功与当时

我想问一下这个方法的不同之处我的关注点是.then和.success,函数以及.error感谢之间的区别.

// Simple GET request example:
$http({
   method: 'GET',
   url: '/someUrl'
}).then(function successCallback(response) {
   // this callback will be called asynchronously
   // when the response is available
}, function errorCallback(response) {
   // called asynchronously if an error occurs
   // or server returns response with an error status.
});
Run Code Online (Sandbox Code Playgroud)

// Simple GET request example:
$http({
   method: 'GET',
   url: '/someUrl'
}).success(function successCallback(response) {
   // this callback will be called asynchronously
   // when the response is available
}).error( function(data) {
   // called …
Run Code Online (Sandbox Code Playgroud)

javascript api angularjs angular-http angular-promise

2
推荐指数
1
解决办法
2654
查看次数