I am debugging someone else's software. It uses Angular 1.5.9, which I am not very familiar with and I have not been able to find an answer to my questions.
- I would like to call a $scope function that exists in a separate controller, from another controller in a separate js file. 
- The broadcast statement below throws an error and I am unsure as to why? "TypeError: Cannot read property '$broadcast' of null" 
Here is the code:
CONTROLLER 1:
app.controller('FilterController', function ($scope, $filter, 
$uibModalInstance, errorService, dataService, values) {
    $scope.sortByColumn = function () {
      var data = { 'editorID': $scope.editorID(), 'filter': 
      dataService.data.objFilterColumns };
      dataService.getData('UpdateFilter', data).then(function (response) {
        $uibModalInstance.dismiss('cancel');
        //I WANT TO CALL THE SCOPE 'reloadData' FUNCTION HERE
        $scope.$emit('reloadData', data);
        //this broadcast statement was already there but it throws error 
        $scope.$parent.$broadcast('sortbyColumn', $scope.userFilters, $scope.column.strColumnName, $scope.orderDir, dataService.data.objFilterColumns);
    });
  });
CONTROLLER 2:
 app.controller("myCtrl", [
"$scope",
"$http",
"$uibModal",
"$log",
"$location",
"$window",
"dataService",
"errorService",
"lookupService"
, function ($scope, $http, $uibModal, $log, $location, $window, dataService, errorService, lookupService) {
    $scope.loadPage = function (data, message, removeFilter, byColumn, 
 orderDir) {
    //I want to call this function from the other controller 
  }
  $scope.$on("reloadData", function () {
     $scope.loadPage();
  });
  $scope.$on("sortbyColumn", function (event, filters, column, orderDir, filter) {
    //some code
  });
}]);
Thanks for your help
 
     
     
    
