prevent closing Foundation modal when clicking outside of the modal
I don't want the modal to go away when I click on the background. I'd like it to keep display until I click the button inside the modal. Here is a codepen link
http://codepen.io/anon/pen/JdNXGd
here is the angular code
app = angular.module('app', ['ngAnimate']);
app.directive('modal', function() {
return {
restrict: 'E',
scope: {
show: '='
},
replace: true, // Replace with the template below
transclude: true, // we want to insert custom content inside the directive
link: function(scope, element, attrs) {
scope.hideModal = function() {
scope.show = false;
};
},
template: "<div class='ng-modal' ng-show='show'>"+
"<div class='reveal-modal' data-options='close_on_background_click:false' ng-show='show'>"+
"<div ng-transclude></div>"+
"<a class='close-reveal-modal' ng-click='hideModal()'>×</a>"+
"</div>"+
"<div class='reveal-modal-bg' ng-click='hideModal()'></div>"+
"</div>"
};
});
app.controller('AppCtrl', ['$scope', function($scope) {
$scope.modalShown = false;
$scope.toggleModal = function() {
$scope.modalShown = !$scope.modalShown;
};
}]);
Solution 1:
Finally found the solution that works. I added
backdrop : 'static'
into $modal.open