Search⌘ K
AI Features

Setting up the admin Route

Explore how to set up the admin route handler in Ember to display all products and enable editing through a nested dynamic route. Learn to modify templates with the each helper and LinkTo component to navigate within the same admin interface, improving routing control and application structure.

The admin route contains all the products. When we click on any product, the edit route should load on the same admin.hbs template.

Setting up the admin route handler

We can set up the admin route handler and return all the products to our template in the following way:

Javascript (babel-node)
import Route from '@ember/routing/route';
import { products } from '../data/products';
export default class AdminRoute extends Route {
model(){
return products;
}
}
  • Line 2: We import products ...