Closed alex88 closed 8 years ago
@alex88 you're right that we should be using the public API method sendAction
here.
It will break current implementation thought, since users will have to bind the afterCopy action manually, will you plan to release this in next major release or what?
sendAction
is for sending said actions to a controller. I think the proper way of doing this is to call methods directly on the component.
So for example we'll define a function called afterCopy
that you can override when extending the component.
Can you give me an example of that?
If you don't bind the action on the controller nothing happens and the user can bind the afterCopy
action to whatever he wants and for every component instance
I think the latest implementation might be a good fix for now until this is refactored in a major release: https://github.com/aomra015/ember-cli-zero-clipboard/blob/master/addon/components/zero-clipboard.js#L14
Basically it will try to send the action, recover and then log the error.
Shouldn't the component use sendAction instead of send? So the user can skip having an afterCopy action or bind it to another name and also, not having an error when the action is not defined?