Example jsbin: http://jsbin.com/ICoLOgO/4/edit
If I have a mixin that provides an action, with ember 1.0-rc.5 the action would be invoked without warnings. Upgrading to ember 1.0 final causes a deprecation warning to show:
Action handlers implemented directly on controllers are deprecated in favor of action handlers on an `actions` object
Is there a simpler way to expose individual actions in an action map without needing to use function.apply?
I just put the common actions in the actions
hash on the mixin, and Ember took care of properly merging the actions hashes with any controllers that extend the mixin.
App.PaginatedListController = Ember.Mixin.create({
queryParams: ['page'],
page: 0,
actions: {
nextPage: function() {
this.incrementProperty('page');
},
previousPage: function() {
this.decrementProperty('page');
},
}
});
App.PostsController = Ember.ArrayController.extend(App.PaginatedListController, {
actions: {
// controller specific actions here
}
});
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