angularjs - $scope.$on executing more than once -
i using broadcast , $scope.$on , method in $scope.$on executing multiple times. here code. in controller: $scope.selectitem = function(index, item){ baseservice.hideview(); }, $scope.$on("closeview",function(){ $log.debug("insideon: calling hidevieweditem"); $scope.hidevieweditem(); }); in baseservice : app.factory('baseservice', function ($rootscope, $log, $location) { return { hideview :function(){ $log.debug("calling closeview"); $rootscope.$broadcast("closeview", 1); } } }); here calling hideview once hidevieweditem calling 3 times. in console getting these messages. calling closeview insideon: calling hidevieweditem insideon: calling hidevieweditem insideon: calling hidevieweditem how make call once?