外部でクリックしたときにモーダルが閉じないようにするか、キーボードでesc
を押します。だから私は、ボタンがモーダルを開くためにクリックし、以下のように背景:ngDialogモーダルで 'static'が機能していない
var app = angular.module('MyApp', ['ngDialog', 'chatSocket']);
app.controller('MainCtrl', function ($scope, ngDialog) {
$scope.openChatBox = function() {
ngDialog.openConfirm({
template: 'chatBox.html',
controller: 'msgController',
backdrop: 'static',
keyboard: false,
scope: $scope //Pass the scope object if you need to access in the template
}).then(
function(value) {
//You need to implement the saveForm() method which should return a promise object
$scope.closeChat().then(
);
},
function(value) {
//Cancel or do nothing
}
);
};
});
をbackdrop:'static'
とkeyboard:false
を使用し、
<button ng-click="openChatBox()" >Open</button>
機能しない理由私のコードの問題は、どのようなものですか?
この「ngDialog.openConfirm」とは何ですか?通常は '$ modal.open'を使用します – DilumN