From the course: Building Angular and ASP.NET Web API Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating an HttpPut request in Angular

Creating an HttpPut request in Angular

From the course: Building Angular and ASP.NET Web API Apps

Start my 1-month free trial

Creating an HttpPut request in Angular

- [Instructor] Now that we have created the Angular part, and we have also set up the endpoint, let us connect these with each other by sending a request from the front end, and then receiving a response. For that, let us go to our project. The first thing that we need to do in here is that we need to create an additional method in our entry.service.ts file, and let us name our new method updateEntry. This method will have two parameters. The first parameter is going to be the id, and the second one is going to be the entry. Now, let us write in here return this.http.put because we want to send an HTTP put request. And then, inside the put method, let us write this.baseUrl, and then, to this baseUrl, we want to append the id as well. So for that, let us write in here slash and then plus id. And then next, let's us add the entry as a parameter as well. So this is all we have to do in our entry.service.ts file. Next, let us go to our update-entry folder. And inside here, up on the TS…

Contents