Asked By: Anonymous
I’m doing this tutorial from SmashingMagazine (http://coding.smashingmagazine.com/2013/11/07/an-in-depth-introduction-to-ember-js/) and I keep hitting this error when I try to use a button calling a custom action:
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.
user.js
controller:
App.UserController = Ember.ObjectController.extend({
actions: {
edit: function(){
this.transitionToRoute('user.edit');
}
}
});
user.hbs
view:
<div class="user-profile">
<button {{action "edit"}}>Edit</button>
<!--<img {{bind-attr src="avatarUrl"}} alt="User's avatar" />-->
<h2>{{name}}</h2>
<span>{{email}}</span>
<p>{{bio}}</p>
<span>Created {{creationDate}}</span>
</div>
{{outlet}}
useredit.hbs
view:
<div class="user-edit">
<label>Choose user avatar</label>
{{input value=avatarUrl}}
<label>User name</label>
{{input value=name}}
<label>User email</label>
{{input value=email}}
<label>User short bio</label>
{{textarea value=bio}}
</div>
All the rest is working fine. I can display my user list and invidual users.
Thanks!
Solution
Answered By: Anonymous
I found my error. I accidently overwrited my user.js
route file. Replaced the content with:
App.UserRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('user', params.user_id);
}
});
Sorry for bothering, and thanks 🙂