How to access application controller from another controller?
Or
How to access another controller from controller?
How to access application controller from another controller?
Or
How to access another controller from controller?
应用控制器:
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);
....
....
}
});