Reputation: 796
Currently I have an View in my application template that sends an event to the ApplicationController. I really would rather just send it to the another controller, PlaylistController, directly from the View, but I can't figure out how.
This is my current ApplicationController
App.ApplicationController = Ember.ArrayController.extend({
needs:['playlist'],
changeSong: function(delta) {
this.get('controllers.playlist').send('changeSong', delta);
}
});
And this is the view, which is in the application template:
App.NextSong = Ember.View.extend({
classNames: ['entypo', 'to-end'],
tagName: 'a',
click: function() {
this.get('controller').send('changeSong', 1);
}
});
Upvotes: 0
Views: 87
Reputation: 4964
Just copying my answer from the comments above.
In this specific case, you can use:
<a {{action changeSong target="controllers.otherController"}}>click</a>
You'll have to define your other controller under the needs
property of whatever controller is in charge of the template.
Upvotes: 1