In Http Module I can easily get the response code using response.status, but when I used HttpClient Module I cannot get the response.status, it shows undefined.
So, how can I get the response.status using HttpClient module in Angular 4. Please help.
From this section, this is the adjusted code
http .post<T>('/yoururl', whateverYourPostRequestIs, {observe: 'response'}) .subscribe(resp => { console.log(resp); });
the answer is {observe: 'response'}. you can then view the logged resp and pick/choose what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With