AngularJs broadcast repeating execution too many times

Can you try just using $scope.$on()? Every time controller A is created, it is adding a new listener on the root scope, and that doesn’t get destroyed when you navigate away and back. If you do it on the controller’s local scope, the listener should get removed when you navigate away and your scope gets destroyed.

// controller A
$scope.$on("myEventFire", function(event, reload) {
    someAction();
});

$broadcast sends the event downward to all child scopes so it should be picked up on your local scope. $emit works the other way bubbling up towards the root scope.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)