3

我正在尝试执行以下操作:

我在表格中有一个列表

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

我想在项目本身之后呈现项目的详细信息。这样:

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

不幸的是,它不起作用。Ember 希望将插座放置在每个插座之外。我能做点什么吗?也许是上下文变化?还是我唯一能做的就是 dom 操作?(这不是最好的!!)

谢谢你

4

1 回答 1

2

您不能在循环{{outlet}}内使用帮助程序。{{each}}一些替代方案:

//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}}
于 2013-04-30T20:27:25.067 回答