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

Passing properties to components

While we just mentioned that components are isolated from the rest of the application, there is room for them to communicate with the host application in several ways. First, they're able to bind to proprieties in the host template context. For example, we just mentioned that the preceding button component is used to prompt the user to upload images. The component requires that an enumerable property, which will act as the photo store, be bound to its posts property:

{{post-input posts=model}}

This way, the component will be able to store the provided photos, as we will discuss in a later section. These selected photos will then be displayed to the user in the same template as:

<script type="text/x-handlebars" id="photos"> ...

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