Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support value="target.value" #27

Open
lolmaus opened this issue Jun 24, 2016 · 4 comments
Open

Support value="target.value" #27

lolmaus opened this issue Jun 24, 2016 · 4 comments

Comments

@lolmaus
Copy link

lolmaus commented Jun 24, 2016

It's not possible to use {{route-action}} with native HTML controls because the helper is unable to extract the value.

E. g.:

<select onchange={{action 'someAction' value="target.value"}}>

This works with a normal action but fails with a route-action.

@rwjblue
Copy link
Contributor

rwjblue commented Jun 24, 2016

Heh, "not possible" is relative. You could write your actions to accept the full event and that would work fine...

I do agree that parity with {{action in this way would be nice, though I really hate the name value for what should be valuePath.

@lolmaus
Copy link
Author

lolmaus commented Jun 24, 2016

@rwjblue

You could write your actions to accept the full event and that would work fine...

Well, when you do {{route-action}}, the action function is not passed any event.

@gogromat
Copy link

+1
I would like this feature as well.
As an example if a component has a select box (native) with onchange event that passes in value="target.value" then I would not need to map actions on the component element and simply calling route-action from component would map to the proper action defined in my route.

Otherwise I need to say something like:
{{component actionFromComponent=(route-action 'actionInRoute')}} and in the action itself within a component: <select {{action 'actionInComponent' value='target.value' on='change'}} and have the

actionInComponent() {
  this.sendAction('actionFromComponent');
} 

@gssonal
Copy link

gssonal commented May 21, 2018

Hi All,

Is there any solution to this issue?
I am trying to use route-action helper for checkbox as follows:
<input type="checkbox" onchange={{route-action "selectAllTables" value="target.checked" }}>Select All

It calls my action inside route, but it is passing some event object instead of checked value (I am expecting true/false) like it does for the usual action helper:

I am also facing the same issue while using select drodown:
<select class="col-sm-8" onchange={{route-action "setSelection" value="target.value"}}>
-- JDBC or HDFS load? --
JDBC
HDFS

Here I am expecting to get the values JDBC or HDFS when the actions is fired.

If it can be done by writing action to receive full event, please give some example how to extract required information from the event.

I am new to ember. Please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants