Set the value in the public controller in the form of a broadcast, and cannot listen in the child controller

1. The value is passed in the two controller (controller), and with the help of the third common controller (the parent controller), the result is that the event broadcast downwards in the parent controller is not available from the controller.
2. The code is as follows

var KisBpmStringPropertyCtrl = [ "$scope","$rootScope", function ($scope,$rootScope) {
        // 
        $scope.$emit("changeDate",$scope.property.value);
        
    };

the code for the first controller (sub-controller 1) is shown above.

$scope.$on("changeDate",function (event, data){
            alert(data);
            $rootScope.assignment="\${userId}";
            $rootScope.$broadcast("dataChange","");
        });

the code for the parent controller is shown above.

var KisBpmAssignmentPopupCtrl = [ "$scope", function($scope) {
    //
    $scope.$on("dataChange",function(event,data){
        alert(3);
    });
}]
The code for the second controller is shown above.
purpose: the first controller propagates the message up to the parent controller, and the parent control listens to it and then broadcasts the message down to the second controller.
result: in the third step, the message broadcast down cannot be listened for.

Mar.07,2021
Menu