Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I prevent angular-ui modal from closing?

I am using Angular UI $modal in my project http://angular-ui.github.io/bootstrap/#/modal

I don't want user to close the modal by pressing on backdrop. I want a modal can only be closed by pressing close button which I have created.

How do I prevent modal from closing ?

like image 489
Rahul Prasad Avatar asked Nov 29 '13 12:11

Rahul Prasad


People also ask

How do I stop angular modal dialog closing?

You can prevent closing of modal dialog by setting the beforeClose event argument cancel value to true. In the following sample, the dialog is closed when you enter the username value with minimum 4 characters. Otherwise, it will not be closed.

How do you stop a modal closing?

Data-keyword="false" is to prevent closing modal while clicking Esc button, while data-backdrop="static" , allows you keep modal pop-up opened when clicking on Gray area.

How do I keep my bootstrap modal from closing when I click the button?

To prevent closing bootstrap modal when click outside of modal window we need add properties data-backdrop="static" and data-keyboard="false" to button which we are using to show modal window like as shown following.


1 Answers

While you creating your modal you can specify its behavior:

$modal.open({    // ... other options    backdrop  : 'static',    keyboard  : false }); 
like image 74
artur grzesiak Avatar answered Oct 21 '22 16:10

artur grzesiak