A slightly more idiomatic way to invoke actions in your Ember components.
ember install ember-invoke-action
This add on places the method invokeAction
on every component. This method will test for a closure action, and if
none is found, it will return undefined
let x = invokeAction('onChange', newValue);
If an action is required for your component to work, you can add it the the array requiredActions
. If an action
is not passed, an error will be thrown.
requiredActions: ['onChange']
If you wish to check for required parameters, the array 'requiredParams' is available.
This code was inspired by @miguelcobain, I just made an addon out of it.