In AngularJS we can broadcast, and listen for events:
$rootScope.$emit('myEvent',$scope.data);
$rootScope.$on('myEvent', function(event, data) {}
Is there any way to listen for events inside a component?
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.
<div ng-repeat="someObject in mainModel.listOfObjects">
<someControl ng-model="someObject.foo"></someControl>
<custom-component ng-model="someObject.bar"></custom-component>
</div>
<someButton ng-click="executeActionOnAllCustomComponents()">