0
votes

"Routes and controllers that handle actions must place action handlers inside an actions hash. Even if a route has a method with the same name as the actions, it will not be triggered unless it is inside an actions hash. In the case of a controller, while there is deprecated support for triggering a method directly on the controller, it is strongly recommended that you put your action handling methods inside an actions hash for forward compatibility."

That is from the ember documentation, it sounds like I should put my actions inside the actions hash within a controller, but after I put the action inside the hash, my controller complains that Uncaught Error: Nothing handled the event 'submit'.

//this works
App.StartController = Ember.Controller.extend({
    submit:function(){
        alert(1);
    }
});

// this complains Uncaught Error: Nothing handled the event 'submit'.
App.StartController = Ember.Controller.extend({
    actions:{
        submit:function(){
            alert(1);
        }
    }
});

BTW, I am using v1.0.0rc

1
This behavior is brand with 1.0.0 final. So plz upgrade from your RC (actually there are 8 RCs out there).mavilein
OMG, I wish they said something about this in their documentation! I am very frustrated about the inconsistencies between the documentation and the videos I have watched...James Lin
Yes this can be painful, but from now on there will be no more such problems, since they hit 1.0.0 final. :-) Keep on going! It's worth it :-)mavilein

1 Answers

0
votes

Just to reference @mavilein's comment, I updated my ember libraries and it's working now.