Send actions to Ember.js components
npm install ember-component-inbound-actions

!Ember Version
Send actions to Ember.js components. Inspired by Sam Selikoff's blog post
Questions? Ping me @gavinjoyce
This is an Ember CLI addon, so all you need to do is
npm install --save-dev ember-component-inbound-actions
orember install ember-component-inbound-actions
Add the InboundActions mixin to your component:
``javascript
import Em from 'ember';
import InboundActions from 'ember-component-inbound-actions/inbound-actions';
export default Em.Component.extend(InboundActions, {
name: 'Larry David',
actions: {
reset: function() {
this.set('name', '');
}
}
});
`
When declaring your component in a template, include an actionReceiver attribute:
`handlebars`
{{name-form actionReceiver=nameForm}}
This allows you to reference the nameForm in your controller and invoke actions on it:
`javascript`
this.get('nameForm').send('reset');
Or use the send helper to invoke actions on your component reference from within the template:
`hbs
{{name-form actionReceiver=nameForm}}
`
* git clone this repositorynpm install
* bower install
*
* ember server`
* Visit your app at http://localhost:4200.