I've got a Mixin in my controller that has a particular action. I need to override this action, do some stuff, and then call the original action provided by the Mixin.
How can I do this?
this._super()
doesn't seem to work in this case (which does make sense, as it's meant to call the superclass' implementation, not a Mixin's).
In order to call this._super
from Ember.run.next
try the following,
http://emberjs.jsbin.com/docig/3/edit
App.MyCustomMixin = Ember.Mixin.create({
testFunc:function(){
alert('original mixin testFunc');
},
actions:{
testAction:function(){
alert('original mixin testAction');
}
}
});
App.IndexController = Ember.Controller.extend(App.MyCustomMixin,{
testFunc:function(){
alert('overriden mixin testFunc');
var orig_func = this._super;
Ember.run.next(function(){
orig_func();
});
},
actions:{
test:function(){
this.testFunc();
},
testAction:function(){
alert('overriden mixin testAction');
var orig_func = this._super;
Ember.run.next(function(){
orig_func();
});
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With