are responsible for displaying the model to the user by turning it into HTML • In many applications, models are loaded via an HTTP JSON API, although Ember is agnostic to the backend that you choose
template which model it should display (such as a url of /cars renders a collection of cars) • Queries the model and makes it available in the controller and templates • As the templates or models being shown to the user change, Ember automatically keeps the URL in the browser's address bar up-to-date
able to share the URL of your app. When someone clicks the link, they reliably see the same content as the original user. • Can also… …set properties in Controllers …execute events and actions …connect a particular template to a particular controller
Each template is backed by a model, accessed via the controller, and the template automatically updates itself if the model changes • Written in the Handlebars templating language • So they can include things such as… …other templates …usual logic such as if and else
from the template's model and put it into HTML …outlets, which are placeholders in a template that routers can plug other templates into. You can put outlets into your template using the {{outlet}} helper. …components, custom HTML elements that you can use to clean up repetitive templates or create reusable controls.
the user can see in the browser • Associated with a controller, a handlebars template and a route • Handle events or custom interactions that are impossible to manage from templates • didInsertElement hook where can interact with jQuery very easily • Become extremely useful when you need to build reusable views, such as modals, popovers, date-pickers and autocomplete fields
model set on them by a route • Act as bridge between the model and the view or template • A template can retrieve properties from both the model and a controller • Are auto-generated if not explicitly defined
logic • In general, your models will have properties that are saved to the server, while controllers will have properties that your app does not need to save to the server • When a template references a property, the property value on the controller is returned if it exists, otherwise the model assigned to the controller is looked at next
a route, Ember will automatically make one for you based on the return value of the route's model hook • If it returns an object (such as a single record), an ObjectController will be generated • If it returns an array, an ArrayController will be generated • If it does not return anything, an instance of Ember.Controller will be generated
routes and templates • Controllers are like decorators for your models; routes are more like traditional controllers for your application • Think long and hard before putting actions on controllers. Should instead put them on the lowest shareable route.