2015-11-04 139 views
0

当过我尝试从子类ember.js调用基类的方法,我得到以下错误Ember.js如何从子类调用超类或基类方法?

断言失败:Ember.Object.create不再支持调用定义方法_Super

App.BaseClass = Ember.Object.extend({ 
sayHello: function(){ 
    //my code 
} 
}); 

App.SubClass = App.BaseClass.extend({ 
//some code here 

sayHellow: function(){ 
//some code of subclass 
. 
. 
. 
this_super(); // This causes error: Assertion failed: Ember.Object.create no //longer supports defining methods that call _super 
} 
}); 
+0

'this_super'是一个错字吗? “Hello”与“Hellow”是否有错字? – 2015-11-04 09:40:46

回答

0

你应该使用this._super()

sayHello: function(){ 

//some code of subclass 

. 

. 

. 

this._super(); 

// This causes error: Assertion failed: Ember.Object.create no //longer supports defining methods that call _super 

} 

}); 
+0

亲爱的我已经使用this._super()这会导致断言失败错误 –

+0

您使用this_super() –

相关问题