給予responce.json()不爲我的情況下發揮作用調用成功,在angular2中使用訂閱錯誤回調?
component.ts
this.AuthService.loginAuth(this.data).subscribe(function(response) {
console.log("Success Response" + response)
},
function(error) {
console.log("Error happened" + error)
},
function() {
console.log("the subscription is completed")
});
AuthService.ts
loginAuth(data): Observable<any> {
return this.request('POST', 'http://192.168.2.122/bapi/public/api/auth/login', data,{ headers:this. headers })
.map(response => response)
//...errors if any
.catch(this.handleError);
}
給予[對象,客體] 如果我把.map(response => response.json())這樣的map函數服務給出錯誤,像responce.json()不是函數
請幫我