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

Components as layouts

A component's template can act as a layout for other application templates. These layouts are not specified in the view layer; they use block expressions instead. Additional content can then be inserted inside these templates without losing scope. For example, imagine we wish to create a component that will use the content-editable element. This kind of component will need to wrap a section of some HTML content as:

{{#content-editable}}
<p>Tweet content</p>
{{/content-editable}}

As shown, the component uses custom Handlebars tags that match its namespaced template name. The content inside and outside the component will still enjoy the same scope. Can you guess how this component will be implemented? One implementation will ...

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