Skip to content

Instantly share code, notes, and snippets.

@mattmazzola
Last active October 28, 2015 06:42
Show Gist options
  • Save mattmazzola/84acc0da7c4cf269145c to your computer and use it in GitHub Desktop.
Save mattmazzola/84acc0da7c4cf269145c to your computer and use it in GitHub Desktop.
Dockyard Article possible bug in expense-summary/component.js
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
amountChanged() {
const expense = this.get(this, 'expense');
//this.sendAction('update', expense); <-- Typo? Should be 'ammountChanged' instead of 'update'
// Everything works in the twiddle, but I think the names were changed in the article.
// The first argument to sendAction should be the name of the action
// which should match the name of the attribute
// From the usage in the parent template, we know this attribute is about to the update function
// so it's effectively going to call the expense-table's update(expense)
this.sendAction('amountChanged', expense);
}
}
});
<tr>
<td>{{expense.category}}</td>
<td>{{input type="integer" value=expense.amount}}</td>
<td><button {{action 'amountChanged'}}>Save</button></td>
</tr>
<table class="expenses">
<tbody>
{{#each expense in expenses}}
{{expense-summary expense=expense amountChanged="update"}}
{{/each}}
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment