0
在新的EmberRC1版本中,似乎我们无法从创建的对象中调用超类方法。我有一些标准的混合和视图,我用它来创建或扩展到其他对象。我有一些方法重写,但仍然需要执行超级方法,我们可以在以前的版本中使用this._super()
。但在新版本中,当我创建一个对象时,这不会发生。当创建对象时this._super()问题
window.App = Ember.Application.create();
App.Router.map(function(){
this.resource("users");
});
App.UsersView = Ember.ContainerView.extend({
init : function(){
this._super();
this.pushObject(App.TestView.create({
didInsertElement : function() {
this.$().append(' <br><h4>Appended at Object</h4> ');
}
}))
}
});
App.TestView=Ember.View.extend({
templateName:'test',
didInsertElement : function() {
this.$().append(' <br><h4>Appended at Class</h4> ');
}
});
因此,这部分完全去除,或者我们可以达致这超级调用一些其他的方式?
要了解我的问题,请拨打jsfiddle。
PS:我知道我可以让代码需要用其他方法名执行并调用相同的方法。但如果我有解决方案,这将是很好的。