mercredi 12 août 2015

Ember: Call an action from a button in a nested div

So I have an Ember application that uses bootstrap. I got that working fine it seems, but I'm having issues getting a button from within a dropdown menu to trigger an action. I can have a button outside of that dropdown call the same action, and it works fine.

Controller:

actions: {
clearWords: function(){
       console.log("clear it!!");
  }
}

HBS:

<li>
   <div class="dropdown"> ...
      <button type="button" {{action "clearWords"}}>Clear</button>
   ...
   </div> 
</li>
<li>
  <button type="button" {{action "clearWords"}}>Clear</button>
  <!-- ^^ this one works -->
</li>

I've tried adding target to the action bit, but that never works either.

{{action "clearWords" target="controller.controllerName"}}

Any suggestions to get me in the right direction would be much appreciated.

PS: If you happen to be kind enough post sample code from JSBin, could you use JSFiddle instead? I can't see JSBin behind my proxy here :(




Aucun commentaire:

Enregistrer un commentaire