AngularJS $uibModal关闭传值和多层弹窗关闭问题

1.关闭传值示例:

// 通过声明变量操作

var modalInstance = $uibModal.open({

      scope:dScope,

      animation: true,

      templateUrl:'弹框页面所在路径',

      controller: 'btnCtrl',   //弹框的controller

      size:'lg'  //控制弹框大小 /sm

    });

    //弹框关闭时的方法

    if(modalInstance.result){

      modalInstance.result.then(function(‘传值’){

        //隐藏弹框的业务逻辑

        console.log('传值');

      },function('传值'){

        //关闭弹框的业务逻辑

        console.log('传值');

      });

    }

    //弹框打开之后执行的函数

    modalInstance.opened.then(function(){

      //模态窗口打开之后执行的函数

    });

2.多层弹窗关闭:

将弹窗内容提到单独html,并定义controller与之对应,

ui-bootstrap-tpls.js部分源码:

'modal-instance': '$uibModalInstance',
close: '$close($value)',
dismiss: '$dismiss($value)'

实例为:$uibModalInstance

有colse和dismiss方法,无cancle方法

更多内容参考:https://www.cnblogs.com/shixy1617/p/8550766.html和底部相关评论

发布了65 篇原创文章 · 获赞 8 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/u012382791/article/details/96130809