Create Components

Because a component makes use of a template to define its UI but is itself added to a containing template, the relationship between components and templates can be a bit tricky. It helps me to think of the {{input}} control as an example. It’s a stand-alone control that can be used in a generic Ember template. The components you’ll define work the same way.

Before we can create our component, we need a place for it to live. We’ll create a new route and reference our new component from that route’s template. Because we’re editing a single note at a time, the most sensible place for this route to live is as a child of the notebooks/notes route.

From a command prompt, run the following Ember CLI command:

 $ ​ember generate ...

Get Deliver Audacious Web Apps with Ember 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.