I just upgraded from ember.js RC7 to RC8 and found that a simple template (shown below) would throw a deprecated warning
"Action handlers implemented directly on controllers are deprecated"
{{input class="firstName" type="text" placeholder="first name" value=firstName }}
{{input class="lastName" type="text" placeholder="last name" value=lastName }}
<button class="submit" {{action addPerson}}>Add</button>
<br />
<table>
{{#each person in controller}}
<tr>
<td class="name">{{person.fullName}}</td>
<td><button class="delete" {{action deletePerson person}}>Delete</button></td>
</tr>
{{/each}}
</table>
How should I modify the above template to correct this?
It looks like I just needed to give the PR a look that changed this :)
In my controller I just needed to move the addPerson / deletePerson under actions like so
App.PeopleController = Ember.ArrayController.extend({
actions: {
addPerson: function() {
var person = {
firstName: this.get('firstName'),
lastName: this.get('lastName')
};
App.Person.add(person);
},
deletePerson: function(person) {
App.Person.remove(person);
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With