3 回答

TA貢獻1804條經(jīng)驗 獲得超2個贊
鈮
.then()
.success()
.then()
.success()
.then()
-承諾API的全部功能,但稍微詳細一些 .success()
-不回承諾,但略帶約束的語法

TA貢獻1806條經(jīng)驗 獲得超5個贊
success()
返回原來的承諾 then()
回報一個新的承諾
then()
$http.get(/*...*/). then(function seqFunc1(response){/*...*/}). then(function seqFunc2(response){/*...*/})
$http.get()
seqFunc1()
seqFunc2()
success()
$http(/*...*/). success(function parFunc1(data){/*...*/}). success(function parFunc2(data){/*...*/})
$http.get()
parFunc1()
,parFunc2()
并行

TA貢獻1828條經(jīng)驗 獲得超4個贊
then
:
$http.get('/someURL').then(function(response) { var data = response.data, status = response.status, header = response.header, config = response.config; // success handler}, function(response) { var data = response.data, status = response.status, header = response.header, config = response.config; // error handler});
success
/error
:
$http.get('/someURL').success(function(data, status, header, config) { // success handler}).error(function(data, status, header, config) { // error handler});
- 3 回答
- 0 關注
- 410 瀏覽
添加回答
舉報