I have two controllers (Main controller and Child controller). I am trying to pass value from Main to Child controller.
Here are the controllers:
.controller('mainController', ['$scope', '$rootScope', '$location', 'CIFactory', function ($scope, $rootScope, $location, CIFactory) {
    $scope.moveTool = function (buildServerTool) {  //Am calling this moveTool function from View
        $scope.tool = buildServerTool.toolname;
        $scope.$broadcast('update_parent_controller', $scope.tool);
    };
}])
.controller('childController', ['$scope', '$rootScope', '$q', '$timeout', '$log', 'CIFactory', function ($scope, $rootScope, $q, $timeout, $log, CIFactory) {
    $scope.$on('update_parent_controller', function (event, tools) {
        $scope.tools = tools;
    });
}])
When I debug, control is going in moveTool() function, but it is not going inside $on(i.e., value in tools is not assigned to $scope.tools. What am I doing wrong here ?
 
     
     
    