zoukankan      html  css  js  c++  java
  • angularjs modal 嵌套modal的问题

    anguarjs中当遇到modal嵌套modal的时候,比如一个modal弹出啦一个modal1,关闭modal1后,modal本身的关闭功能失效,那么需要$modal来生命弹出的modal1并且关闭

    js:

    .controller('infoWindowCtrl', function($scope,NiDialog,$modal) {
    $scope.showInfo = function(obj,title) {
    var modalInstance;
    modalInstance=$modal.open({
    windowClass: '',
    size:'tableContent',
    backdrop: 'static',
    keyboard: false,
    templateUrl: '/static/tpl/front/order/contactInfo.tpl',
    controller: 'contactCtrl',
    resolve:{
    id:function(){
    return obj.$parent.model.id;
    },
    title:function(){
    return title;
    }
    }
    });
    }

    })
    .controller('contactCtrl', function($scope,NiDialog,NiHttp,$modalInstance,id,title) {
    var vm = $scope.vm = {};
    var fn = $scope.fn = {};
    fn.close=function(){
    $modalInstance.close();
    }
    }])

    To close a $modal that you have opened you can follow these steps.

    1) Inject $modalInstance into the controller that you specified when you created the modal. In your case you called it contactCtrl.

    2) Have a function in your ModalInstanceCtrl that calls .close() on $modalInstance.

    具体参考:http://plnkr.co/edit/SpEx6Y?p=preview

  • 相关阅读:
    MVC模式的学生信息增删改查
    常用排序算法
    2803 爱丽丝·玛格特罗依德
    3118 高精度练习之除法
    中秋练习题
    poj2011
    P1558 色板游戏
    P1830 轰炸III
    P1656 炸铁路
    1067 机器翻译
  • 原文地址:https://www.cnblogs.com/qyhol/p/5542545.html
Copyright © 2011-2022 走看看