Ember component sendAction() not working
You should define where the action will be sent when defining a component in the template.
{{edit-item value=desc createItem='someactionoutside'}}
this is in case the action has a different name in different places (since this is a component, it could have different meanings in different locations). It also avoids clashing actions/triggered actions. Think of the idea of having two instances of a component, and each one should trigger a different action in the controller
{{edit-item value=desc createItem='createUser'}}
{{edit-item value=desc createItem='createShoppingCart'}}
in your case you can just write
{{edit-item value=desc createItem='createItem'}}
And inside your component you would call
this.sendAction('createItem', param1, param2, ....);
If you don't care about it being self contained like a component, you might want to just use a view and not a component. You can register it as a helper and it'd look just as pretty.
Em.Handlebars.helper('edit-item', Em.View.extend({
templateName: 'some_template',
actions: function(){
// etc etc
}
}));
{{edit-item}}
As an addition to the nice answer by @Kingpin2k you can also define your action's name within the component if it is always the same and you want to simplify the syntax of including your component. ie.
import Ember from 'ember';
export default Ember.Component.extend(SchoolPlayerProspectMixin, {
//Here we define an attribute for a string that will always be the same
transitionToRoute: "transitionToRoute",
somethingChanged: function(){
console.log( "OMG something changed, lets look at a post about it!" );
//Here we are passing our constant-attribute to the sendAction.
self.sendAction('transitionToRoute', "post.show", post );
}.observes('changableThing'),
});
In this example the component uses the parent controllers transitionToRoute method to change routes, even though the component may not be a button/link. For example, navigating on change of a component containing several select inputs, or just changing route from within a component in general.