I am currently working on a small application using Angular.JS. In my opinion, I have the following button
<md-button class="md-primary" ng-click="editUser(user, $event)">Edit</md-button>
The editUser method looks something like this:
$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) {
Now the dialog is well displayed, and the response function is also called as expected.
However, when I click the button, the second time the editUser function is not executed. As if the onClick event from the button was deleted when the dialog box was closed.
Any help to solve this problem is much appreciated. Thanks
source share