The usage of the $ionicModal service is explained here: http://ionicframework.com/docs/api/service/$ionicModal/
I have a situation where it happens that I open more
You can solve by hiding the modal you don't want to be on top, for example:
function showSignupModal() {
if ($scope.loginModal.isShown())
$scope.loginModal.hide();
$scope.signUpModal.show();
}
However, if you want to keep the loginModal open in background for some reason, you can open and close the loginModal beforehand this way:
function showSignupModal() {
if (!$scope.loginModal.isShown())
$scope.loginModal.show();
$scope.loginModal.hide();
}
$scope.signUpModal.show();
}