Reputation:
In this amazing video (https://www.youtube.com/watch?v=udix3GZouik) Alex Blom talks about "hacks" in Ember for mobile world.
At 22:00 he says something about <button onclick=()>
vs simply {{action}}
.
Can you say something more about this? What he really means? Is today still like this?
It works just for <button>
tag? And for <a>
?
Upvotes: 1
Views: 119
Reputation: 6221
For your first question:
Action helper has two different usage: As normal helper and as closure action.
This usage is closure action usage:
<div onclick={{action "save"}}></div>
While this is event attachment usage:
<div {{action "save"}}></div>
For your second question:
In the "Specifying DOM event type" section of the ember documentation about action helper, it is described as:
By default the {{action}} helper registers for DOM click events.
But if you can override this behaviour by passing on
parameter as below:
<div {{action "anActionName" on="doubleClick"}}>
To read more:
Upvotes: 1