How to get some specific controller's $scope variable?
myApp.factory('Comment', ['$http', function ($http) {
var comment = {};
comment.add = function (shortName, taskNum, message) {
// how to call controller's method
// the following line dosen't work
myApp.ListPanelController.showTaskDetail(shortName, taskNum);
}
return comment;
}
myApp.controller('ListPanelController', ['$scope', 'Comment',
function ($scope, Comment) {
$scope.showTaskDetail = function (shortName, taskNum) {
Tasks.get(shortName, taskNum).success(function (data) {
// do something
});
}
}]
);