jeudi 24 septembre 2015

How do I send a component action to a route action in Ember.js?

I have an Ember.js application with the following structure:

  • A list-items.js route with the template list-items.hbs
  • Within the above template, I have a component called {{table-view}} which renders the contents from components/table-view.hbs into the above template
  • The components/table-view.hbs template has the following code:

    <button {{action 'addRecord'}}>Add Record</button>

When I click the button, I am able to call the addRecord action within the component's table-view.js file but what I actually need to do is pass this action to the route's addNewItem action. I am trying to pass the action to route by doing this.sendAction('addNewItem') but that doesn't seem to work. How do I pass the action to the route's addNewItem action? Thanks.




Aucun commentaire:

Enregistrer un commentaire