简体   繁体   中英

Ember.js hasMany relationship data display using fixtures

I am trying to display data from hasMany relationship using fixtures. My code is available here: http://jsbin.com/xijewu/8/edit

<script type="text/x-handlebars" id="item">
  <h2>{{ title }}</h2>
  <p>{{ description }}</p>

    {{#each comment in model.comments}}
      {{ comment.content }}
    {{/each}}

</script>

But it seems to be not displaying the data. Any idea ?

I found a related discussion here: http://discuss.emberjs.com/t/what-is-an-async-relationship-async-true-vs-async-false/4107/6 I added the aync: true option and it's working now!

comments: DS.hasMany('comment', {
  async: true
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM