I have an ember controller which has some actions. Inside those actions I want to be able to call another function to regroup functionality but I don't want to do it through this.send('someAction')
, I just want to call it directly and not have anything except that controller call that function.
actions: {
my_btn_click: function(){
this.set('somthing', 'something else');
//functionA call here, not this.send('something');
}
},
//declare functionA here ? doesnt work.
Ember objects are just extensions to plain JS objects, meaning you can define methods on them and call them (through this
) as you would on regular objects:
functionA: function() {
}
actions: {
my_btn_click: function(){
this.functionA();
}
},
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