我不希望当我点击背景时模式消失。我希望它保持显示,直到我单击模式内的按钮。这是一个代码笔链接
http://codepen.io/anon/pen/JdNXGd
这是 Angular 代码
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;
};
}]);
最佳答案
终于找到有效的解决方案了。我添加了
backdrop : 'static'
进入$modal.open
关于angularjs - 防止在点击模式外部时关闭 Foundation 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30677280/