我在我的服務如下:如何記錄成功輸出結果?
return this.http.get(this.wakeUrl)
// ...and calling .json() on the response to return data
.map((res:Response) => {res.json()
console.log("Hello")
})
//...errors if any
.catch((error:any) => Observable.throw(error.json().error || 'Server error'));
我可以在Chrome中的網絡選項卡,響應回來成功地與一個200看到的,但我怎麼也登錄在控制檯? 在我的部分,我想訂閱的是,但我也不得到任何輸出...
this.myService.makeHttpCall().subscribe(
data => {
console.log(data)
},
err => {
console.log(err);
});
如何登錄: 1-只要數據回來我的服務? 2-在我注入服務的組件內?