dimanche 2 août 2015

An action is not passed from a component to the application

In an Ember 1.13 application, I have this template :

{{#each searched_skills as |searched_skill|}}
  {{#skill-card searched_skill=searched_skill delete=delete}}{{/skill-card}}
{{/each}}

This controller :

export default Ember.Controller.extend
  actions:
    delete: ->
      console.log "test"

This template for the component :

<div class="col-md-4 well skill">
  <a {{action 'delete'}}>Delete</a>
  <h1>{{searched_skill.skill.name}}</h1>
  <p>{{searched_skill.description}}</p>
</div>

And this code the component :

export default Ember.Component.extend
  actions:
    delete: ->
      @sendAction 'delete', @get('searched_skill')

I want to show "test" in the console when I click on the "delete" button. The "delete" action of the component is triggered but the action of the application controller.

Where am I wrong?




Aucun commentaire:

Enregistrer un commentaire