0
「的console.log」數據有服務返回一些數據:我如何從響應
return this._http.get(`api/data`)
.map((response: Response) => response.json());
我如何console.log(response.json())
或者是有什麼更好的方法來檢查resonse?
「的console.log」數據有服務返回一些數據:我如何從響應
return this._http.get(`api/data`)
.map((response: Response) => response.json());
我如何console.log(response.json())
或者是有什麼更好的方法來檢查resonse?
return this._http.get(`api/data`)
.map((response: Response) => {
var result = response.json();
console.log(result);
return result;
});
或更好
return this._http.get(`api/data`)
.map((response: Response) => response.json())
.do(value => console.log(value));
確保您已導入您使用的運營商。
哦,我正在嘗試'.then',但這是承諾的方式,它沒有工作,所以現在我看到我必須使用'.do'。必須瞭解更多關於觀測值的信息.. – sreginogemoh