Setting up Application Controllers

Learn to set up the controllers in an Ember application.

Setting up the add route controller

To add a new product to the database, we need to use the controller to get product details from the add route input. First, we use the command below to create the add route:

ember g controller admin/add

This command creates an add.js file in the app/controllers/admin path. Open the add route template to define the action we want to trigger when the user clicks the “Submit” button:

Get hands-on with 1200+ tech skills courses.