源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2020-10-28 06:58 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:浅谈angular2的http请求返回结果的subcribe注意事项
[b]实例如下:[/b]
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注意事项就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部