Use Case:
Let us say for example we created a widget to just upload a file and other widget to display the files for the current record. As and when the file is uploaded in the first widget, we need to refresh the attachment list in second widget
This can be done by sending a broadcast message from the client controller in first widget and capturing that signal in the second widget
First Widget
$rootScope.$broadcast(‘file-attached’,null);
},1000);
Second Widget
$rootScope.$on(‘file-attached’, function(event,data) {
console.log(‘YYYYYYYYYYYYY event recevied’);
$scope.refreshAttachments();
})
$scope.refreshAttachments =function() {
$scope.attachmentHandler.setParams(“u_custom_table”, $scope.data.sys_id, 1024 * 1024 * $scope.data.maxAttachmentSize);
$scope.attachmentHandler.getAttachmentList();
}