Neither $rootScope.$broadcast nor $rootScope.$emit is working from my factory
I have $rootScope injected into the factory. The factory returns this function:
alertHook: function() {
$rootScope.$broadcast('getRollups', 'finally');
}
I injected that factory into a directive and call the alertHook() function.
I am listening for getRollups like so:
$scope.$on( 'getRollups', function( evt, args ) {
console.log( args );
});
Lo and behold, nothing is logged to the console. I've also tried $emit instead of $broadcast.
Help please, before I go insane :)
With factories use
$rootScope.$broadcast:For more information, see