title: angularjs send message from service
body: <p>I have a service which creates a configuration object for an external component.
  One of the config properties is an optional function that gets called when some event (non angular) gets triggered.</p>
  
  <p>e.g.
     {
       eventHandler:function(e) { ... }
     }</p>
  
  <p>Inside this eventhandler I want to send a message to the current controller.
  I tried getting instance of $rootService but it doesn't know about $broadCast.</p>
  
  <p>update : the code (simplified version, to keep code short)</p>
  
  <pre><code>app.service('componentService',['$rootScope', 
    function($rootScope) {
       this.getConfig = function() {
           return {
              transition:true,
              ... // other config parameters
              clickHandler:function(e) { // event called by external library, e = event args 
                 $rootScope.$broadCast("myEvent",e.value);
              };
       };
       return {
          getConfig : this.getConfig
       }
     }]); 
  </code></pre>