O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Expressing variables

We just mentioned that templates are backed by data that is proxied by the corresponding controller. Handlebars walks down a template, replacing defined expressions with matching values obtained from this data. These expressions are usually variable names enclosed in curly braces. The {{outlet}} expression we just discussed is one such expression. In the chapter sample, the contact.index state is responsible for displaying a contact's detail on the right-hand side of the page. In its corresponding template, we notice that the contact's attributes are expressed using these expressions, but later get replaced, as shown in the following code:

<script type="text/x-handlebars" data-template-name="contact/index"> {{#with controller.controllers.contact}} ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required