I'm facing an issue where I am attempting to send an event from one controller to another and listen for it, but the data is not being displayed on the DOM. Interestingly, there are no errors present. When displaying regular $scope variables from both controllers, it works fine. It seems like the broadcast and on functionality are not working as expected, and since there are no errors, debugging becomes a challenge.
oneApp.controller("twoController",["$log","$scope","$rootScope",function($log,$scope,$rootScope){
var str ="sent from twoController ";
$scope.hey = 215;
$rootScope.$broadcast("hey",str);
}])
oneApp.controller("twoChildController", ["$log","$scope","$rootScope",function($log,$scope,$rootScope){
//var str ="sent from twoController ";
//$scope.display = str;
$scope.$on("hey",function(event,str){
$scope.display = str;
});
}])
If anyone could assist me in resolving this issue, I would greatly appreciate it.