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
To open another modal in modal with Bootstrap, we can set the z-index of the modals.
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.
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.
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();
}
};
}
}
})
};
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With