I want to broadcast angular event from javascript function i.e angular.injector([\'ng\', \'myModule\']).get(\"mySharedService\").prepForBroadcast(\'hello\'); By using above line
Another way of publishing events from one controller and listening them in other controllers would be to use angular-PubSub module.
The PubSub
makes only subscribers to listen to the published events unlike the $rootScope.$broadcast
in which it sends event to all the Scopes in Scope hierarchy making it inefficient as compared to the PubSub approach.