How to access application controller from another controller?
Or
How to access another controller from controller?
Application Controller:
App.ApplicationController = Ember.ObjectController.extend({
findPersonById: function(id) {
.....
....
}
});
Below is the way to access application controller function inside comments controller.
Comments Controller
App.CommentsController = Ember.ArrayController.extend({
needs: ["application"],
getComments: function() {
var person = this.get("controllers.application").findPersonById(id);
....
....
}
});