Specify action event type dynamically in component


Action helper has option on to specify type of an event, for example

<button {{action "select" post on="mouseUp"}}>✓</button>

It is possible to specify variable instead of event name. But this works only in element’s tag, not in component. I tried to do like this

{{button-component (action "select" post on="mouseUp")}}

and it does not work.

How can I specify dynamically event type of an action in the component?


you don’t need to pass action helper, for eg

{{button-component actionType="mouseUp"}}

and in component

    <button {{action "select" post on=actionType}}>✓</button>


I am trying to set action on component’s element (for example, in component.js it will be tagName: ‘div’), not on elements inside the component.

I don’t have element <button> inside my component. It was just an example how to pass event type in element. I need pass event type in component and it must be dynamically.


Is there really no solution? Can anybody help?


just add click method to component like here https://ember-twiddle.com/5822f96b19bc3b1ce9823c715010e5cd?openFiles=controllers.application.js%2Ctemplates.components.my-component.hbs