title: Angular.JS onclick function only called on first click
body: <p>I am currently working on a small aplication using Angular.JS
  In my view i have following button</p>
  
  <pre><code>&lt;md-button class="md-primary" ng-click="editUser(user, $event)"&gt;Edit&lt;/md-button&gt;
  </code></pre>
  
  <p>the editUser method looks something like this:</p>
  
  <pre><code>$scope.editUser = function (user, $event) {
  
      $scope.userToEdit = user;
  
      $mdDialog.show({
              controller: DialogController,
              targetEvent: $event,
              templateUrl: '/js/modules/user/views/edit.tmpl.html',
              parent: angular.element(document.body),
              clickOutsideToClose: true,
              scope: $scope
          })
          .
          then(function (answer) {
              if (answer == "save") {
                  for (right in $scope.allSystemRightsStatements) {
                      if ($scope.allSystemRightsStatements[right].selected) {
                          if( $scope.userToEdit.rights==null){
                              $scope.userToEdit.rights = [];
                          }
                          $scope.userToEdit.rights.push($scope.allSystemRightsStatements[right]);
                      }
                  }
                  $scope.updateUser($scope.userToEdit);
              }
              $scope.userToEdit = {};
          }, function () {
              $scope.userToEdit = {};
          });
  };
  
  $scope.updateUser = function (user) {
      //userService.updateUser makes a $http PUT request
      var promise = userService.updateUser(user);
      promise.then(function (result) {
          $mdToast.show(
              $mdToast.simple(result.message)
                  .position($scope.getToastPosition())
                  .hideDelay(3000)
          );
      }, function (reason) {
          $mdToast.show(
              $mdToast.simple(reason)
                  .position($scope.getToastPosition())
                  .hideDelay(3000)
          );
      }, function (update) {
      });
  };
  </code></pre>
  
  <p>Now the dialog is nicely shown and the answer function is also called, everything as expected. </p>
  
  <p>However, when I click the button a second time the editUser funciton is not executed. As if the onClick event from the button had been removed at dialog close. </p>
  
  <p>Any help on solving this problem is greatly appreciated,
  Thanks</p>