浅谈angular2的http请求返回结果的subcribe注意事项

浅谈angular2的http请求返回结果的subcribe注意事项

实例如下:

this.monitorSer.getVehicleLonAndLat(vehicleIds) .subscribe(  data => {   //将data下的data字符串转化为vehdata数组   this.vehData=JSON.parse(data.data);   //功能实现   this.loadOverLay();  },  error => this.errorMessage = <any>error);//错误处理

subscribe()异步处理,如果需要用返回的数据,最好把方法写在里面。

以上这篇浅谈angular2的http请求返回结果的subcribe注意事项就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

tag:返回结果请求浅谈注意事项电脑软件

相关内容