angular-dialog-service icon indicating copy to clipboard operation
angular-dialog-service copied to clipboard

Stop propagation

Open BartoGabriel opened this issue 10 years ago • 0 comments
trafficstars

Maybe someone will serve my resolution to the next problem.

I have a dropdown in which the user can select options, and has a button to apply the changes. In the event that the user does not select anything, I show an error that asks the user to select something. My problem is that when the user clicks close, the dropdown is also closed.

The solution is to put a stopPropagation to close function:

https://github.com/m-e-conroy/angular-dialog-service/blob/master/src/dialogs.js#L96

$scope.close = function ($event) {
  $modalInstance.close();
  $scope.$destroy();
  $event.stopPropagation();
};

Note that you must change the templates.

ng-click="close($event)"

I think it should be by default. Since you can do whatever you want after closing the dialogue. Needless to propagate the click event.

BartoGabriel avatar Sep 24 '15 16:09 BartoGabriel