From the course: Building Angular and ASP.NET Core Applications
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Adding new data from Angular
From the course: Building Angular and ASP.NET Core Applications
Adding new data from Angular
- [Narrator] Now that we created a form, it's time to add the create functionality in our Angular app. For that we are first going to create a method in Angular service then we are going to inject the service in our component. Then we are going to add the form group to the form. Next, we'll send a request from our component and that the end, we are going to handle the response. So let's go to Visual Code and see this in action. In here we'll go inside the client app and the inside source. App, services and the book_service.ts. Here we are going to create a method named addBook which will take, as a parameter, a book of type book and it will simply return this.http.post and then here write this.baseURL plus, inside double quotes, write / AddBook. Then to this post request we are going to parse, as a parameter, the book. Now let us go to our component, so inside the component go to the new-book folder then…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Angular key concepts2m 25s
-
(Locked)
Generating components and services4m 47s
-
(Locked)
Cleaning up code and updating the router7m 11s
-
(Locked)
Designing the Books page8m 10s
-
(Locked)
Reading data from Angular3m 39s
-
(Locked)
Designing the Create page9m 4s
-
(Locked)
Adding new data from Angular9m 50s
-
(Locked)
Designing the Book Details page7m 44s
-
(Locked)
Getting a single book from Angular3m 18s
-
(Locked)
Updating existing data from Angular9m 20s
-
(Locked)
Deleting data from Angular6m 45s
-
(Locked)
Handling errors in Angular12m 24s
-
-
-
-