Below is my code. It’s just returning undefined:
this.http.post(
'https://abcd.com/request.api',
JSON.stringify(requestData),
{
'Content-Type': 'application/json'
}
)
.then(data => {
console.log(data.status);
console.log(data.data); // data received by server
console.log(data.headers);
})
.catch(error => {
console.log(error.status);
console.log(error.error); // error message as string
console.log(error.headers);
});