I have a post service that returns some data from service but I can’t access it in case of success. Here is the code
return new Promise(resolve => {
this.http.post(ConstantsModel.signUpClientUrl, JSON.stringify(body), {headers: headers})
.subscribe(data => {
console.log(data._body); -------> This line gives error "Body doesn't exists"
if(data.status == 200){
console.log(data);
resolve('You signed up successfully!');
} else {
resolve("Problem signing up! Please try again in a moment");
}
},
error => {
resolve(error._body);
console.log(error._body);
});
});