Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 334
srn Avatar asked Dec 05 '14 19:12

srn


People also ask

Can I open a modal inside a modal?

To open another modal in modal with Bootstrap, we can set the z-index of the modals.

How do you show a modal pop up above other modal pop up?

Try setting the z-index of the popup wrapper you want above greater than the other.. This is provided that #popup1 and #popup2 have the same parent. Show activity on this post. set the z-index of popup which should be on the top, highest than any other element on the DOM.

How do I transfer data from one modal to another modal?

Data can be passed to the modal body from the HTML document which gets displayed when the modal pops up. To pass data into the modal body jquery methods are used. jQuery is similar to JavaScript, however jQuery methods are simple and easier to implement. jQuery reduces the lines of code.


2 Answers

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();
                    }
                };
            }
        }
    })
};
like image 180
Saeed Torabi Avatar answered Oct 18 '22 05:10

Saeed Torabi


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

like image 43
Fabricio Duarte Avatar answered Oct 18 '22 05:10

Fabricio Duarte