title: angularjs: broadcast event from service
body: <p>I would like to create a custom event in angularjs. The goal is that the event will be broadcast by a service and must be catched in a controller.</p>
  
  <p>I have in my service :</p>
  
  <pre><code>function doSomething() {
          // do something...
          $rootScope.$broadcast("bced");
          $rootScope.$emit("emitted");
          console.log('event');
  }
  </code></pre>
  
  <p>and my controller :</p>
  
  <pre><code>$rootScope.$on("bced",function(){
      console.log("catched");
  });
  $rootScope.$on("emitted",function(){
      console.log("catched");
  });
  
  $scope.$on("bced",function(){
      console.log("catched");
  });
  $scope.$on("emitted",function(){
      console.log("catched");
  });
  </code></pre>
  
  <p>But I can't catch events in controller.
  <code>console.log('event')</code> is shown but I can't catch any events.
  Could someone explain me how to do that please? 
  <code>$rootScope</code> is correctly declared in the service and in the controller.</p>