title: How to listen for an event in AngularJS component?
body: <p>In AngularJS we can broadcast, and listen for events:</p>
  
  <pre><code>$rootScope.$emit('myEvent',$scope.data);
  
  $rootScope.$on('myEvent', function(event, data) {}
  </code></pre>
  
  <p>Is there any way to listen for events inside a component?</p>
  
  <p>What I want to achieve is to execute some action on set of components which are repeated inside a form. Ng-repeat iterates over some model of course. Some data from the model is bound to the component. It's easy to bind function to component, so component can execute some logic, but the opposite direction doesn't seem to be so easy.</p>
  
  <pre><code>&lt;div ng-repeat="someObject in mainModel.listOfObjects"&gt;
     &lt;someControl ng-model="someObject.foo"&gt;&lt;/someControl&gt;
     &lt;custom-component ng-model="someObject.bar"&gt;&lt;/custom-component&gt;
  &lt;/div&gt;
  &lt;someButton ng-click="executeActionOnAllCustomComponents()"&gt;
  </code></pre>