Possible Duplicate:
emberjs: how to trigger a custom event in a View
I’ve created a jsfiddle to demonstrate the issue. WHen you click in the view (on the text) you will see in the console that the view receives the click. But when I create a custom event and trigger it, its not received in the router:
App.IndexView = Em.View.extend({
click: function(e) {
console.log("CLICK");
this.get("controller").send("doStuff");
}
});
App.IndexRoute = Em.Route.extend({
....
doStuff: function(e) {
alert("Do stuff") ;
}
});
Here is a complete working example too http://jsfiddle.net/jeanluca/9Xasr/6/
Any suggestions ?
Cheers
You are calling
doStuff()of the controller for the App.IndexView, but you definedoStuffinside the Route. You should move it intoApp.IndexController:Fiddle: http://jsfiddle.net/8k4PE/
On the other hand, if you want the route to receive the event: