I implemented post method in angular 7. I want status code of post request.
I did following.
const sub = this.service.regEvent(this.pId, this.email)
.subscribe(response => {
console.log('response:', response);
if(response.httpStatusCode === 200) {
}
});
this.subscriptions.push(sub);
regEvent method
public regEvent(pId, email): Observable<any> {
return this.http.post<any>(`this.endpointUrl?eventId=${pId}&email=${email}`,"").pipe(
catchError(this.handleError)
);
}
Here console.log('response:', response); I am getting null.
In browser i checked and it's.
In postman also.
any help would be greatly appreciated.


httpStatusCodeto be there. That's not what the property is called even if you do read the full response as the docs tell you. If you used a better type thananyto describe the actual response, the compiler could help you out.