Angular $rootScope.$broadcast() event caught twice in controller

前端 未结 3 1004
醉梦人生
醉梦人生 2021-02-05 04:27

Broadcating event on button click :-

$scope.onButtonClick = function(){
    $rootScope.$broadcast(\'onButtonClick\');
}

And catching event in

3条回答
  •  滥情空心
    2021-02-05 05:08

    Angular $rootScope.$broadcast() event caught twice in controller

    $scope.$on('saveCancelLeadInfo', function (event, args) {
        if ($scope.$$listenerCount["saveCancelLeadInfo"] > 1) {
            $scope.$$listenerCount["saveCancelLeadInfo"] = 0;
        }
        your code here
    });
    

提交回复
热议问题