2
votes

Hi I have an async model in Ember (because fixtures force you to use async:true) which is not working in the template (the promise is probably not resolved).

This code for example:

{{#each tag in imagepost.tags}}
    <strong class="links-no-color"><a>{{tag}}</a></strong>
{{/each}}

produce:

<App.Tag:ember625:1> <App.Tag:ember626:2> <App.Tag:ember627:3>

Doesn't Ember suppose to see that i access the tags and make the request to the tags endpoint?
How can i manually tell him to work it out? this won't work(in a component):

comments: function() {
    this.get('imagepost.comments').then(function(val){ return val;});
}.property('imagepost'),
1
I'm not sure if I understand the question in the second half, it definitely won't work for a few reasons, one, you don't return anything to the computed property, two, the computed property would just be a promise, not the resolution - Kingpin2k

1 Answers

2
votes

That's working! But you need to reference whatever property you have on the tag model, instead of just the tag record in the loop (I did tag.name)

{{#each tag in imagepost.tags}}
    <strong class="links-no-color"><a>{{tag.name}}</a></strong>
{{/each}}