Setting up Application Controllers
Explore how to set up and configure Ember.js application controllers to manage product data. Learn to implement actions for adding new products, editing existing ones, and deleting entries using controller methods and template inputs. This lesson equips you with essential controller management skills for building dynamic Ember apps.
We'll cover the following...
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:
In line 37, we define a click event handle named addProduct on the Submit button.
We need to ...