emberjs/ember.js — Issue #307: Blocks in handlebars template
Author: raghurajah
Created: 2011-12-27 19:23:30+00:00
State: open

Template blocks would enable containers to be created with no immediate knowledge of children. Currently, the ContainerView can be used to handle hardened views, but generic view-containers cannot be easily created.

Here's an example of what blocks could possibly do,

A generic container called my-page.handlebars could be created as follows. Note that my-page is written without any explicit understanding of who will use it.
```handlebars

{{title}}

{{yield}}

```

Along comes a user, who uses my-page as such,
```handlebars
{{#view SC.View templateName="my-page" title="My Fancy Page"}}

Show something interesting here

{{/view}}
```
This would result in,
```html

My Fancy Page

Show something interesting here

```

And another user might use the same my-page as,
```handlebars
{{#view SC.View templateName="my-page" title="My Colors"}}
Some colors here, perhaps ...
{{#each content.colors}}
{{content}}
{{/each}}
{{/view}}
```
resulting in,
```html

My Colors

Red

Blue

Green

```