Mixin method call override

I have a mixin in my controller that has a specific action. I need to redefine this action, do some things, and then call the original action provided by Mixin.

How can i do this?

this._super () does not seem to work in this case (which makes sense since it means calling the implementation of the superclass, not Mixin).

+7
source share
1 answer

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(); }); } } }); 
+6
source share

All Articles