我的内容包括:
bootstrap.css [ getbootstrap.com/2.3.2 ]
angular/ui-bootstrap-tpls-0.10.0.min.js from: [ angular-ui.github.io/bootstrap ]
我正在使用 AngularJS 和 Twitter Bootstrap。
我从 AngularJS 打开模态窗口,如下所示:
var modalInstance = $modal.open({
templateUrl: 'resources/html/mymodal.html',
controller: 'mymodalController',
scope: $scope
});
我的模态模板是:
<div class="modal">
<
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
.....
</div>
问题:
关闭 [x] 按钮不起作用
当我点击它时,模式不会消失。但是当我按 Esc 时 - 模式消失了。
所以看起来... data-dismiss="modal" 不起作用。有任何想法吗?
the data-dismiss
属性由 bootstrap javascript 使用(据我所知,您从以下位置获取了 html 源代码)http://getbootstrap.com/javascript/#modals http://getbootstrap.com/javascript/#modals )
UI Bootstrap 不会绑定到该关闭按钮,因为它不寻找该属性,您需要添加 ng-click 并关闭模式,如示例中所示
http://angular-ui.github.io/bootstrap/#/modal http://angular-ui.github.io/bootstrap/#/modal
在控制器中:
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
模态模板...
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)