實(shí)例如下:
this.monitorSer.getVehicleLonAndLat(vehicleIds) .subscribe( data => { //將data下的data字符串轉(zhuǎn)化為vehdata數(shù)組 this.vehData=JSON.parse(data.data); //功能實(shí)現(xiàn) this.loadOverLay(); }, error => this.errorMessage = <any>error);//錯(cuò)誤處理subscribe()異步處理,如果需要用返回的數(shù)據(jù),最好把方法寫在里面。
以上這篇淺談angular2的http請(qǐng)求返回結(jié)果的subcribe注意事項(xiàng)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持錯(cuò)新站長(zhǎng)站。
新聞熱點(diǎn)
疑難解答
圖片精選