Angular
Building a CRUD Application with Angular & ASP.Net Core - Services in Angular PUT

Enhancing our component for PUT

PRO

Enhancing our component for PUT

Remember that we gave our users an input box where they could input an id for an item they wanted to edit. If they left the input box blank it meant they were simply adding a new item. In this video, we added the check in our component to check if the user input an ID.

We did this because we needed to know if we should be calling our update method or add method from our service. In the next video we will be connecting up our service so users can actually update existing items.

As a note, this is a pretty rudimentary method for letting a user edit an item but it teaches us the connection and required data to complete a PUT. Also I would recommend more error handling inside of the component to verify the user entered a valid ID. If you want an added challenge implement that error check in your own component.