srn
srn

Reputation: 111

Open modal inside a modal

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

Upvotes: 11

Views: 25961

Answers (2)

Fabricio Duarte
Fabricio Duarte

Reputation: 342

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

Upvotes: 15

Saeed Torabi
Saeed Torabi

Reputation: 41

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();
                    }
                };
            }
        }
    })
};

Upvotes: 3

Related Questions