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

Inserting views into templates

Views are hierarchical, and hence, they can be inserted into the templates of other views constituting the template hierarchy we discussed in Chapter 4, Writing Application Templates. For example, consider the following application template:

<script type='text/x-handlebars' id='application'>
{{view App.HeaderView}}
{{view App.FooterView}}
</script>

As shown, defined views are inserted into a desired template using the view expression. These view expressions can also be wrapped into block clauses, as shown in the following code. Additional views can then be inserted into these block expressions:

{{! application template}} <script type='text/x-handlebars' id='application'> {{view App.HeaderView}} {{#view App.ContentView}} ...

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