I am new to angular JS and Javascript. I am working on a angularJS project and In project i am using several modules like Secreport -> secreportpage -> secchart.
I passed data from mainCtrl to secreportCtrl through service.
StorageService.fetchGraphicalConfig(query.rpt, query.location)
.success(function(graphconf) {
$scope.error = null;
$scope.graphconf = graphconf;
$scope.clickFunction = function() {
$rootScope.$broadcast('update_parent_controller',$scope.graphconf);
};
}).error(function(error) {
$scope.error = error;
$scope.graphconf = null;
});
}
After that i would like to share that same data to secchartctrl in secchart module. so, I used $broadcast,$on in secchartctrl
$scope.$on('update_parent_controller', function (event,graphconf) {
$scope.graphconf = graphconf;
});
// when i debug and move cursor on graphconf in secchartctrl it is showing undefined.
Kindly give a solution for that. Thank you in advance.