Your turn: Implement PUT
It is now your turn to implement PUT in your application. I highly encourage you to complete the exercise and allow users to edit items that have been added to your database through the API.
Steps to complete
- Allow users to choose an item that they would like to edit. This was done in the CampTracker by adding an input box for users to input the ID of the item they wanted to edit.
- Inside your component make sure you still have the ability to add new items but you can add logic to edit existing items if the user chooses to.
- In your service, add the PUT request. Remember PUT requires the object being updated with all of its edits and you pass along the ID of the object as part of the URL.
- Update your BehaviorSubject with the newly updated item. Once your BehaviorSubject has been edited emit out the new list with the next() method.
- Last, implement error handling. At minimum, log out any error messages returned. This will help in the development of the Angular applicaion; providing you with more useful error messages.