title: Why is rootScope.on called multiple times in my application?
body: <p>In my AngularJS application, I have a controller-A and a factory. I am using the following code in factory to call the function in controller-A. In the initial call, the function in controller A's function executes 1 time; on the next call the controller-A's function executes 2 times. Hence the number of times executed get increased for each call. Is it possible to avoid this, please advise me. I have added the factory code and controller-A code below:</p>
  
  <p><strong>Factory code:</strong> </p>
  
  <pre><code> updateUserData: function (value, action) {
      $("#myModalInsertUser").modal('hide');
      var id = value.Id;
      var params = {};
      params.id = depotId;
      $rootScope.selectedId = params;
      $rootScope.$emit("EVENT_1", {id});
  });
  </code></pre>
  
  <p><strong>Controller-A code:</strong></p>
  
  <pre><code>var listener = $rootScope.$on("EVENT_1", function(event, params, reload) {
      $scope.confirmUserInfo(params);
  });
  
  $scope.confirmUserInfo = function(params) {
      $('#myModalConfirmUser').modal('show');
  
      $('#closeConfirmUser').unbind('click').click(function () {
           $('#myModalConfirmUser').modal('hide');
           var params = $rootScope.selectedId;
           $scope.getUsers(params);
           $scope.$on('$destroy', listener);
       });
  }
  </code></pre>