Reputation: 85
First of all,I am new to ember.I have a "show" handlebar inside "templates/orders/show.hbs"
. The form submit action in this handlebar always returning "Uncaught Error: Nothing handled the action 'edit'
. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble." . I have the edit action defined in controllers/orders.js
. Am i placing the edit action in wrong file. If so, what would be the correct place to have the "edit" action.
Handlebar(show.hbs):
<form class="form-horizontal" {{action "edit" this on="submit"}}>
<div class="control-group">
<div class="control-label">
<label>Name</label>
</div>
<div class="controls">
{{input value=name type="text"}}
</div>
</div>
<div class="control-group">
<div class="control-label">
<label>Age</label>
</div>
<div class="controls">
{{input value=fury type="text"}}
</div>
</div>
<button type="submit" class="btn">submit</button>
</form>
controller file (orders.js):
export default Ember.ObjectController.extend({
actions: {
edit: function(){
console.log('EDIT - Entered');
}
}
});
Thanks!
Upvotes: 1
Views: 294
Reputation: 1234
As it was pointed out, your question is a bit vague as to how you're rendering your template.
First, make sure you have the Ember inspector installed. There are versions for Chrome and Firefox, and likely other browsers. This will make debugging your Ember application a lot simpler. With the Inspector installed and open, navigate to the "View Tree" and you should be able to figure out which controller is the active controller for your template.
With the syntax:
{{action "myAction"}}
The action will bubble to the controller that is currently responsible for the template. Additionally, if your template is rendered within a view and you want the view to handle the action and not the controller, you can specify:
{{action "myAction" target="view"}}
Upvotes: 1