我想阻止模態,從外面點擊關閉時或按下鍵盤esc
。所以我用backdrop:'static'
和keyboard:false
像下面,背景:「靜態」沒有工作ngDialog模式
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
}
);
};
});
按鈕點擊打開模式是,
<button ng-click="openChatBox()" >Open</button>
什麼是我的代碼的問題,爲什麼不工作?
這是什麼'ngDialog.openConfirm'?正常地,我們使用'$ modal.open' – DilumN