Reputation: 8775
In version 0.9.3
of Ember.js, I could do something like this:
Item = Ember.Object.Extend({
title: 'A cool item',
subview: Ember.View.extend({
templateName: 'views_items_show'
})
});
var item = Item.create(jsonData);
var itemIndexView = Ember.View.extend({
templateName: 'views_items_index',
item: item
});
itemIndexView.appendTo('body');
Then, in my itemIndexView
view template:
<div class="some-class">
<p>{{item.title}}</p>
<div>
{{view item.subview}}
</div>
</div>
Then, if I update itemIndexView
:
itemIndexView.set('item', newItem);
In Ember 0.9.3 {{view item.subview}}
is updated automatically with the new view. This doesn't work in 0.9.5. Is there a different way to do this now?
Upvotes: 1
Views: 462
Reputation: 9236
You should use Ember.ContainerView
when dealing with dynamic content.
Here is a working sample, refactored from your code: http://jsfiddle.net/MikeAski/d6JD8/1/
Upvotes: 5