Editing a Sighting

After creating and reading data, CRUD tells us that updating is the next step. You have an edit route for a sighting, but you need to put it to use by updating the sighting listing with a button to navigate to the edit route. You also need to add a form with sighting fields to the edit template; have the edit route’s model retrieve witnesses, cryptids, and the sighting; and add route parameters to the edit route object in app/router.js. Finally, you need to create a controller to add actions for the edit form.

Let’s start with adding an Edit button in app/templates/sightings/index.hbs. To give more context to the list, add the name and image of the cryptid that was sighted as well.

... <div class="media well">  ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.