Closed thec0keman closed 8 years ago
@thec0keman This is an ambiguous part of the Emblem syntax, and may need some tweaking.
We explicitly made the decision to do it the way it is to allow someone the ability to use a bound action name if necessary (your first example above, e.g.: {{action boundActionName}}
).
The rule of thumb is that if the action helper is a multi-word string, use the contents of that string exactly.
This means you could get the behavior you want by:
button click="'openItem' item"
compiles to: <button {{action 'openItem' item on="click"}}></button>
We'd be open to a better way to handle this, but it seemed important to allow someone to be able to use an unquoted (bound) action, and this seemed like the only way with the existing syntax.
That makes a lot of sense. I would suggest adding this to the readme / changelog for those making the upgrade.
It would also be good to add that something like this is possible -
a click="actionWithParam 'fixedParamString'" foo
Single quotes are needed around the parameter and double quotes around the entire argument to click
. Although until recently single quotes on the outside worked as well.
I can create a pr if you like.
@andorov yes, please
i'll add it to emblem-site
@bantic i submitted 3 pull requests. let me know if i should make any changes.
@andorov thank you — I don't have commit bit there. @machty Can you add me to emblem-site and/or merge in https://github.com/machty/emblem-site/pull/24 https://github.com/machty/emblem-site/pull/23 https://github.com/machty/emblem-site/pull/22
Passing a bound param into an action fails to quote the action name correct (0.5.0-beta branch).
This string in Emblem:
button click='openItem item' test
should compile to:<button {{action "openItem" item on="click"}}>Test</button>
but instead compiles to:<button {{action openItem item on="click"}}>test</button>