Components: event handlers vs actions


Are event handlers considered bad practice? Should I always use the {{action}} helper in conjunction with the on parameter? Or are there cases when event handlers on the component are preferred?


If my memory does not fail me, you are limited to one {{action}} per tag, so that would be an obvious case for using event handlers. It would make a perfect sub-component however.

Usually, I will use {{action}} when the intent is to actually have the event trigger an action. Validating a form in the change event, toggling some visible stateā€¦
On the other hand, when creating user interactions, such as doing dragndrop, I will use events. Same when I need to catch bubbling events (for instance, closing a dialog on Esc), or when handling performance-critical events (resize).

I would be interested to know the opinion of more seasoned ember developers.


Good points! Thanks for that!

Regarding multiple actions in one tag: This seems to be possible now according to this ticket.