1

How to access application controller from another controller?

Or

How to access another controller from controller?

4

1 回答 1

1

应用控制器:

App.ApplicationController = Ember.ObjectController.extend({

   findPersonById: function(id) {
   .....
   ....
   }
});

以下是在评论控制器中访问应用程序控制器功能的方法。

评论控制器

App.CommentsController = Ember.ArrayController.extend({

   needs: ["application"],

   getComments: function() {

   var person = this.get("controllers.application").findPersonById(id);
   ....
   ....
   }

});
于 2013-07-24T11:16:41.470 回答