Reputation: 13379
In the new EmberRC1 version, it seems that we cannot call super class method from a created object. I have some standard mixins and views which i use to either create or extend to some other objects. I have some methods overriden, but still i needed to execute super methods which we can acheive in previous versions using this._super()
. But in the newer version, when i create an object, this is not happening.
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> ');
}
});
So is this part completely removed or we can acheive this super calling some other way?
To understand my problem here is the jsfiddle.
PS: I know that i can have the code that needs to be executed with some other methodname and call the same method. But it would be nice if i have solution for this.
Upvotes: 0
Views: 213
Reputation: 1395
You can still call this._super() from an init method and it will call the parent. What has been removed is calling create on an object and passing in an init method. There is a createWithMixin method that still allows that functionality.
There is a pretty detailed post about this functionality here:
Difference between .create() and .createWithMixins() in ember
Upvotes: 1