Open modal inside a modal

2019-03-25 09:31发布

I have a angular ui modal. In that there is a button.On clicking this button I want to open another modal in angular ui.how can i do this

 $scope.open = function () {
    var modalInstance = $modal.open({
        templateUrl: 'myModalContent.html',
        controller: ModalInstanceCtrl,

    })
};

myModalContent.html contains a button on clicking which I want to open another modal. <a class="btn btn-success" href="#" role="button" ng-click="openModal()">Open modal</a>

I am unable to open a modal on clicking the button

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-03-25 10:16

and also this sample

$scope.open = function () {
    $scope.insideModalOpen = $modal.open({
        templateUrl: 'myInsideModal.html',
        controller: insideModalInstanceCtrl
    });
    var modalInstance = $modal.open({
        templateUrl: 'myModalContent.html',
        controller: ModalInstanceCtrl,
        resolve         : {
            params : function(){ 
                return {
                    insideModalOpen : function(){
                        $scope.insideModalOpen();
                    }
                };
            }
        }
    })
};
查看更多
欢心
3楼-- · 2019-03-25 10:34

You can easily open a second modal

var modalInstanceSecond = $modal.open({
    templateUrl: 'mySecondModalContent.html',
    controller: 'ModalInstanceCtrl',
});

Take a look at this plunker:

http://plnkr.co/edit/vfWJogYvMFFL2XcvM0pJ?p=preview

查看更多
登录 后发表回答