typescript - 为什么这个订阅会变成 SafeSubscriber
我需要弄清楚为什么我的 this 对象在我的 TS 和 ionic 应用中会从 view controller 变成 SafeSubscriber。
我的数据服务:
getStationData(name:string){
let myURL = "http://some/url/request.php?name="+ name;
return this.http.get(myURL)
.map(
res => {return this.parseData(res._body);},
err => console.log(err));
};
我的视图控制器:
//here, this is still the correct object : view controller
this._dataService.getStationData(name).subscribe((data) =>{
//here, this now becomes of type safe subscriber?
console.log(this);
//when I hover in chrome over this, it shows all view controller parameters.
//but when I call a method, it's not defined?
});
http.get 请求有问题吗?