Search⌘ K

Setting up the edit Route

Understand how to set up a dynamic edit route within Ember.js nested routing. Learn to pass parameters, handle models by creating deep copies, and implement templates that load product data for editing. This lesson equips you with essential skills to manage route data without affecting the original model.

The edit route is the dynamic route in our application. We can click any product title in the admin route to open the edit route with the product’s data. The product_id parameter is passed to the model in the edit route:

Javascript (babel-node)
<LinkTo @route="admin.edit" @model={{item.id}}>
<h6 class="card-title ">{{item.product_title}}</h6>
</LinkTo>

When we click any product title, the product_id of that particular product is passed to the @model.

Setting up the route handler

We need to return the product that ...