From the course: Building Angular and ASP.NET Core Applications

Unlock the full course today

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

Updating existing data from Angular

Updating existing data from Angular

From the course: Building Angular and ASP.NET Core Applications

Start my 1-month free trial

Updating existing data from Angular

- [Instructor] Now let us see how we can update existing data in Angular. So in our case we are going to see how we can update an existing book from our collection. We are going to first create a method in our service. Then we are going to create the view. Then we are going to create the FormGroup in our component.ts file. And to use the method from our service we are going to inject the service. Then next, we are going to send a request and handle response. So let's go to visual code and see this in action. Let us first create the service method. So inside source, app, services, book.service.ts. Here we are gong to create a method which we are going to name updateBook which takes as a parameter a book that we are going to return of this.http dot want to send a put request this.baseURL and then we write inside double quotes UpdateBook slash we want to append to this one the book ID. Because we want to paste the book ID…

Contents