5
API'nin bana geri döndüğü hata gövdesini nasıl ayrıştırabilirim diye sormak isterim. Angular 2'deki ayrıştırma hatası gövdesi
Bu
API getiri resimdir: Ben URL erişebilirsinizlogin(username,password){
let headers = new Headers();
headers.append('Content-Type','application/json');
return this.http.post(this.configEnvironment.url() + "oauth/access_token",
JSON.stringify(
{
username: username,
password: password,
grant_type: "password",
client_id: "xxxxxxx",
client_secret: "xxxxxxxx"
}
),
{ headers }
)
.map(res => res.json())
.catch((err:any) =>{
console.log(err);
return Observable.throw(new Error(err));
});
}
, durum, statusText vb bu kullanarak:
err.status,err,url,error.statusText
İşte
kod bu
Sorunum, hata gövdesinin değerini alamıyorum.
lehine önerilmemektedir. Bu benim sorunumu çözebilir –
@SydneyLoteria Sorun değil. Yapmış olduğum gibi 'err' türünü 'herhangi bir' yanıt 'olarak değiştirirseniz daha iyi IDE yardımı alırsınız. – BeetleJuice
Angular 5 @ açısal/ortak/http yöntemi nedir? –