Call a method of a controller from another controller using 'scope' in AngularJS
问题 I am trying to call a method of second controller in first controller by using scope variable. This is a method in my first controller: $scope.initRestId = function(){ var catapp = document.getElementById('SecondApp'); var catscope = angular.element(catapp).scope(); catscope.rest_id = $scope.user.username; catscope.getMainCategories(); }; I am able to set the value of rest_id but I cannot call getMainCategories for some reason. The console shows this error: TypeError: Object # has no method