Inside one of my Angular controllers, I have this:
// controller A $rootScope.$on("myEventFire", function(event, reload) { someAction(); });
In another controller, I have the following:
// controller B $scope.openList = function(page) { $rootScope.$broadcast('myEventFire', 1); }
Now this is a one-page application. When I first go to controller A and try to fire this event, someAction () will be executed once. If I leave and go back to controller A and do the same, someAction () will execute twice. If I do it again, it will happen three times and so on. What am I doing wrong here?
angularjs angularjs-scope
misaizdaleka Oct 23 '13 at 10:36
source share