I have a loop running in my Ember view template.
In one of the main views, I loop over the the controller content, and then loop over some content inside of that:
{{#each version in versions}}
{{#each comment in version.comments}}</p><br/>
<p>{{comment.text}}</p>
{{/each}}
{{/each}}
When I create a new comment with App.Comment.createRecord(content); elsewhere in my code, the template doesn’t update automatically. How do I ‘nudge’ it so that it re-renders the content?
Thanks!
I was creating a new comment with:
App.Comment.createRecord(content);… when in fact I should have used:
version.get('comments').createRecord(content);By scoping
createRecordto the same object which is being rendered, Ember will automatically pick up that the object has changed and will update the view as expected.Thanks!