使用新的emberJS RC1版本,我无法将containerView添加为父容器视图的子视图。
window.App = Ember.Application.create();
App.Router.map(function(){
this.resource("users");
});
App.UsersView = Ember.ContainerView.extend({
init : function(){
this._super();
this.pushObject(Ember.ContainerView.create({
init: function(){
this.pushObject(Ember.View.create({
templateName : 'test1'
}));
}
}));
}
});
以下是jsfiddle
答案 0 :(得分:0)
您不应该使用init函数来设置对象的属性。如果你使用'didInsertElement'它可以工作:
App.UsersView = Ember.ContainerView.extend({
didInsertElement : function(){
this._super();
this.pushObject(Ember.ContainerView.create({
didInsertElement: function(){
this.pushObject(Ember.View.create({
templateName : 'test1'
}));
}
}));