Tried to find some basic information for AngularJS $rootScope.$broadcast
, But the AngularJS documentation doesn't help much. In easy words why do we use this?
Also, inside John Papa's Hot Towel template there is a custom function in the common module named $broadcast
:
function $broadcast() {
return $rootScope.$broadcast.apply($rootScope, arguments);
}
I did not understand what this is doing. So here are couple of basic questions:
1) What does $rootScope.$broadcast
do?
2) What is the difference between $rootScope.$broadcast
and $rootScope.$broadcast.apply
?