At Westonci.ca, we provide clear, reliable answers to all your questions. Join our vibrant community and get the solutions you need. Get the answers you need quickly and accurately from a dedicated community of experts on our Q&A platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.

How to get response from post request angular.

Sagot :

Answer:

I am trying to get full response from a POST request. I have read how to get full response for a get request mentioned at the official site of angular. Angular http

What it says is to add { observe: 'response' }. But it would work for a get request and not for post request. post request accepts 2-3 arguments, so I cannot send this as the 4th argument. Please have a look at my code and let me know what I am doing wrong.

Explanation:

const httpOptions: { headers; observe; } = {

 headers: new HttpHeaders({

   'Content-Type':  'application/json'

 }),

 observe: 'response'

};

return this.http.post('http://localhost:3000/api/Users/login', data, httpOptions) ..

Thank you for visiting our platform. We hope you found the answers you were looking for. Come back anytime you need more information. We appreciate your time. Please come back anytime for the latest information and answers to your questions. We're glad you visited Westonci.ca. Return anytime for updated answers from our knowledgeable team.