Patrick Patrick - 1 year ago 89
AngularJS Question

Modal closes when clicked outside (angularjs-- plunker attacked)

I tried various solutions posted online for how to disable modal closing when we clicked outside the modal. I didnt find a working solution.

Can someone please let me know how to achieve it in my case.

Heres the plunker

$scope.modal = {
title: "Enter Details",
html: true,
show: true,

set this parameter. Yet cldnt get it working.


You can use data attributes on the button you are clicking to open the modal, it will wire the modal through bootstrap to not close. like this:

<button type="button" class="btn btn-md btn-primary" data-animation="am-flip-x" data-backdrop="static" data-keyboard="false" data-template-url="modal/docs/modal.demo.tpl.html" data-placement="center" bs-modal="modal">Open modal</button>

Notice I added these 2 data attributes:

data-backdrop="static" data-keyboard="false"

Here is your Plunker code edit to keep the modal open: