1
votes

How to access application controller from another controller?

Or

How to access another controller from controller?

1

1 Answers

1
votes

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);
   ....
   ....
   }

});