Models

In Ember, templates are always backed by models. This means that an object (or array of objects) will be passed as an argument when the template is rendered to a string of HTML and appended to the DOM.

The model object can have properties with strings, arrays, or other objects. When writing templates with Ember and Handlebars, you access this object with the double curlies.

When you want to display the value of a model property, you write {{model.name}}, where name is a property on the model object. The dot syntax should feel familiar, but do not be fooled into thinking any JavaScript code can go within the curlies.

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.