How can get HttpClient Status Code in Angular 4

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.

Leave a Comment