我正在使用Bootstrap和Angular来构建模型对话框,我不想在按下esc键时关闭模型。现在我的模型在转出逃生键时正在关闭。
var modalInstance = $modal.open({
backdrop: 'static',
Keyboard: false,
templateUrl: 'userprofile.html',
controller: 'UserProfileController'
});
<div class="container" style="overflow: auto;width:750px;height:500px">
<div class="userProfile">
<form name="userForm" ng-submit="submitForm(userForm.$valid)" novalidate>
<div class="row-flow">
<!-- First NAME -->
<div class="form-group-profile col-sm-6 required"
ng-class="{ 'has-error' : userForm.firstName.$invalid && !userForm.firstName.$pristine }">
<label class="form-control-label">FIRST NAME</label>
<input type="text" name="firstName" class="form-control" ng-model="firstName"
required>
<p ng-show="userForm.firstName.$invalid && !userForm.firstName.$pristine"
class="help-block">First name is required</p>
</div>
<!-- Last NAME -->
<div class="form-group-profile col-sm-6 required"
ng-class="{ 'has-error' : userForm.lastName.$invalid && !userForm.lastName.$pristine }">
<label class="form-control-label">LAST NAME</label>
<input type="text" name="lastName" class="form-control" ng-model="lastName"
required>
<p ng-show="userForm.lastName.$invalid && !userForm.lastName.$pristine"
class="help-block">Last name is required</p>
</div>
</div>
</form>
</div>
</div>
答案 0 :(得分:3)
问题在于您的设置。您有Keyboard
而不是keyboard
。
答案 1 :(得分:1)
$(document).ready(function () {
$('.modal').each(function () {
$(this).modal({
keyboard: false,
show: false
})
});
});
我运行上面的代码来禁用所有bootstrap模式的键盘。但是我没有使用角度。键盘属性看起来像全小写。尝试更改为全部小写以查看它是否有所作为?