Closing Modal after the opening of more than 2 Modals

I built this code, the problem that if I opened a profile on each other can only last close.
There is a way to fix it?

    $rootScope.closeProfile = function(numid){

	$rootScope.openProfile = function($event,numid){
		$rootScope.userID = numid;

		$ionicModal.fromTemplateUrl('templates/profile.html?id='+numid, function(modal){
			$scope.numid = modal;
			$rootScope.userID = numid;
			scope: $scope, animation: 'slide-in-right'

I didnt’ quite understand… You’re trying to make a Modal view to describre profiles, passing the ID variable? And you open ‘2’ of them, but when closing, only the last one closes, is that right?

Yes :slight_smile: (20 characters)

I think it should be easier to just make a ‘angular route’ passing the parameters via $stateParams…

But if you want to use modals, i guess that you should name each modal in a unique name, and then close it by its name.

Another thing you could try to do is instead of $scope.numid.remove(); you could use $scope.numid.hide(); maybe, but i don’t know if it will work.

I am not at home now, so i can’t test it at the moment, sorry ‘-’. Best of luck to you man :wink: