第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

angularjs中http怎么接受數(shù)據(jù)

angularjs中http怎么接受數(shù)據(jù)

猛跑小豬 2019-04-09 05:04:26
angularjs中http怎么接受數(shù)據(jù)
查看完整描述

2 回答

?
蕪湖不蕪

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超7個(gè)贊

angularjs中是啟用一個(gè)異步的promise處理包括http在內(nèi)的很多業(yè)務(wù)。promise對(duì)象可以通過(guò)then方法注冊(cè)之后進(jìn)行的事項(xiàng)。比如

1

2

3

4

5

6

7

8

9

10

promise = $http.get() //這就會(huì)返回一個(gè)promise對(duì)象

//http的promise會(huì)將http的相應(yīng)對(duì)象做為下一個(gè)處理函數(shù)的參數(shù)

promise2 = promise.then(successFunction,errorFunction) 

//promise.then方法可以設(shè)定成功的情況、失敗的情況的執(zhí)行,

//對(duì)于http而言就是請(qǐng)求的響應(yīng)碼

//prmoise.then的返回結(jié)果仍然是promise

promise3 = promise2.then(successFunction2,errorFunction2) 

//若successFunction,errorFunction成功執(zhí)行則successFunction2將上述方法的返回值作為參數(shù)執(zhí)行

//若successFunction,errorFunction執(zhí)行失?。ùa報(bào)錯(cuò)或者angular自帶方法拋出錯(cuò)誤)則由errorFunction2執(zhí)行,angular自帶方法拋出的結(jié)果會(huì)作為參數(shù)

//注successFunction、successFunction2、errorFunction、errorFunction2都是函數(shù)

 

 


查看完整回答
反對(duì) 回復(fù) 2019-04-10
?
慕村225694

TA貢獻(xiàn)1880條經(jīng)驗(yàn) 獲得超4個(gè)贊

$http({
method:'POST',
url:_finalUrl,
data:_data,
headers:{
'Content-Type': 'application/x-www-form-urlencoded'
}
}).success(function(data){
deferred.resolve(data);
}).error(function(data, status, headers, config) {
deferred.reject('Then was an error');
});


 


查看完整回答
反對(duì) 回復(fù) 2019-04-10
  • 2 回答
  • 0 關(guān)注
  • 634 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)