如何定义/设置Ember的部分模型? [英] How to define/set a model for Ember's partial?

查看:78
本文介绍了如何定义/设置Ember的部分模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ember指南中,部分似乎神奇地获得了作者的名字和



但是尝试失败,看到我的jsbin ,我有两个模型:组织(名称和描述)和成员(名称)。组织显示成功,但我无法显示会员。

 < script type =text / x-handlebars id =organization> 
...
{{partialmember}}
< / script>

< script type =text / x-handlebarsid =_ member>
以下是会员:
< ul>
{{#each member}}
< li> {{member.name}}< / li>
{{/ each}}
< / ul>
< / script>


解决方案

我已经在这里修复: http://jsbin.com/iwiruw/239/edit



爱德华


如果您对此有任何疑问

In the Ember guide, the partial seem to magically get author's firstname and lastname attributes.

But it is failing for my try, see my jsbin where I have two models: Organization (with "name" and "description") and Member (with "name"). Organizations is displayed successfully, but I'm failing to display the Members.

  <script type="text/x-handlebars" id="organization">
      ...
      {{ partial "member" }}
  </script>

  <script type="text/x-handlebars" id="_member">
     Here are the Members:
     <ul>
      {{#each member}}
        <li>{{member.name}}</li>
      {{/each}}
     </ul>
  </script>

解决方案

I've fixed it here: http://jsbin.com/iwiruw/239/edit

Let me know if you have any questions about how it works.

Edward

这篇关于如何定义/设置Ember的部分模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆