2015-11-04 134 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() –

相關問題