Alive Developer
Alive Developer

Reputation: 1022

ember.js how to render outlet inside each

I'm trying to do the following:

I have a list inside a table

<table>
{{#each controller}}
  <tr> 
    <td>
      {{#linkTo person this}}{{name}}{{/linkTo}}
    </td>
  </tr>
{{/each}}
</table>

and i would like to render the details of an item just after the item itself. in this way:

<table>
{{#each controller}}
  <tr> 
    <td>
      {{#linkTo person this}}{{name}}{{/linkTo}}
    </td>
  </tr>
  <tr>
    {{outlet}}
  </tr>
{{/each}}
</table>

Unfortunately it does not work. Ember wants the outlet to be placed outside the each. Can i do something? maybe a context change? or the only thing i can do is a dom manipulation? (that's not the best!!)

thank you

Upvotes: 3

Views: 545

Answers (1)

Mike Grassotti
Mike Grassotti

Reputation: 19050

You can't use the {{outlet}} helper inside of an {{each}} loop. Some alternatives:

//Basic view helper
{{view App.Item}}

<!-- Block view helper -->
{{#view App.Item}}
   <!-- template here -->
{{/view}}

<!-- just the template -->
{{template item}}

<!-- same as template but with leading _underscore -->
{{partial item}}

Upvotes: 2

Related Questions