2
我想問一下關於這個方法的區別 我關心的是.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.
});
和
// 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 asynchronously if an error occurs
// or server returns response with an error status.
});
http://www.syntaxsuccess.com/viewarticle/angular-promises%E2%80%93then-vs-success –
不要使用成功和錯誤,然後使用和捕捉。 – dfsq
'.success'和'.error'已棄用。 – Claies