lundi 16 février 2015

why is my ember action not firing first time I click it?

I've got a view with a handlebars template that looks like this:



{{#each event in group.items}}
<div class="event">
<div class="details">
<span class="name">
<a {{action 'setActionSelectorEvent' event}}>{{event.prettyName}}</a>
</span>
</div>
</div>
{{/each}}


The controller has an action hash like this:



actions: {
setActionSelectorEvent: function(event) {
alert('got the action');
//do stuff
}


The template is rendered perfectly. The problem is that the action doesn't get called the first time you click the anchor. Every time thereafter, the action fires just fine. But the first time, something prevents the action from going through, and I don't see the alert. What could possibly be causing this?





Aucun commentaire:

Enregistrer un commentaire