bug 随记 —— data-dismiss=“modal“

data-dismiss=“modal” 用于button上 是一个自定义的 HTML5 data 属性。在这里它被用于关闭模态窗口。

  • 问题:

angularJS bootstrap 多层modal,二级modal 显示时,一级modal消失了(且二级modal有一级modal的button触发)。期望两个modal都应展示,只不过二级modal展示在一级modal上层。

  • bug示例:

在这里插入图片描述

  • code片段
  <div class="modal-footer">
       <button type="button" class="btn btn-danger"  ng-click="delete()" data-dismiss="modal">Unpublish</button>
       <button type="button" class="btn btn-primary" ng-click="closeModal()" data-dismiss="modal"> Close </button>
  </div>
$scope.delete= function() {

        ModalService.showModal({
            templateUrl: "xxxx.html",
            controller: "AlertCtrl",
            inputs: {
                params: {
                    title: "delete",
                    message: "Are you sure you want to delete?",
                    confirm: "confirm",
                    cancel: "Cancel"
                }
            }
        }).then(function(modal) {
            
            console.log(modal)
            modal.element.modal();
            modal.close.then(function(result) {
            })
       });
    };
  • 期望效果:

在这里插入图片描述

  • 解决方案:

去掉button上的 data-dismiss="modal"属性。data-dismiss="modal"作用是关闭模态窗。

<button type="button" class="btn btn-danger"  ng-click="unpublishInterop()">Unpublish</button>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值