-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close on modal Backdrop #1087
Comments
Give this a try in a directive: document.addEventListener('tap', function(event) {
var target = angular.element(event.target);
if (target.hasClass('modalbackdrop')) {
$rootScope.$apply(function() {
$rootScope.$broadcast('modal-backdrop-click');
});
}
}); Then catch that event in your controller. |
Hey Your code always has the target as HTML if we click on the backdrop. If we click on the modal it will give the proper modal element. I modified the Example Code Pen to reporduce the same http://codepen.io/anon/pen/pqIba?editors=001 |
I'll wait until Adam commits the new tap refactor, then try this. |
Added! |
I don't want to hide the modal on backdrop click... Is there any attribute to set the flag, whether or not to hide the modal on backdrop click? |
I used popup to get the required behavior. Thanks. |
My bad, I forgot to include the option. Added. |
@ajoslin May I know the option to prevent the modal from hiding when I click the backdrop? Thanks, |
@ajoslin Gotacha!!! from your previous comment Thanks Again :) |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
How can we achieve closing the modal on modal backdrop click? I tried writing a directive to close the modal on backdrop click but the click event is never triggered. Any Suggestions?
The text was updated successfully, but these errors were encountered: