Rendering a view inside #each

ember.js

Solution

You're missing a #

If you want to use an inline template, the view helper takes a #

{{#each posts}}
  {{#view App.MyPost}}
    <div>Some HTML here</div>
  {{/view}}
{{/each}}

so it's basically either:

{{view App.MyPost}}

or:

{{#view App.MyPost}}
  <!-- template here -->
{{/view}}

Problem

Whenever I try to render a view inside an #each block, I get a PrecompilationError saying: `Compiler said: Error: each doesn't match view`. Example: ``` {{#each posts}} {{view App.MyPost}} <div>Some HTML here</div> {{/view}} {{/each}} ``` I need to do some stuff when before a single post is rendered, so my guess was that I need a custom view (App.MyPost) to implement the 'willInsertElement' hook. What am I doing wrong?

Original source