Changed your code for you (I tested and it works):
/app/templates/template.hbs => No change
/app/templates/components/my-component.hbs
{{input value=coolField}} <button {{action 'lookup'}}>Look it up!</button>
/app/controllers/my-controller.js => No change
/app/components/my-component.js
export default Ember.Component.extend({ actions: { lookup() { this.attrs.submit(this.get('coolField')); } } });
In addition, the stated reason for connecting such actions (from the book Rock and Roll with Ember ):
“Closing actions are obviously an improvement over old-style actions. They are easier to reason and debug, because if the named action does not exist in the context of the template, we will get a clear error message ...”
“Another advantage of closing actions, which are only functions, is that they have a return value that we can use at the point where we process (call) the action. This can be used to see if there was an upstream the action is successful or go back further information, something that was not possible with bubbling actions. "
source share