How to send form action from a component to route


in my application I am using a component to create a form and i need to save form data to db when i submit it. i wish to do the saving from a route. how can i do that


You could write the form data directly like this:

and use saveAction="saveAuthor" to call saveAuthor on the route:


{{blog-author-edit author=author isEditing=isEditing saveAction="saveAction" deleteAction="deleteAction"}}


{{#blog-authors authors=model page=page perPage=perPage createAction="createAuthor"}}{{outlet}}{{/blog-authors}}

With closure actions you can improve this.

{{!-- route backed template, i.e. not a component --}}
<form {{action 'actionName' on='submit'}}>
  {{input value=model.firstname}}
  {{input value=model.lastname}}
  <button type="submit">Save</button>