Was $ionicModal intended to be independent and not singleton?


#1

Just from following the tutorials/documentation, I’m noticing that the $ionicModal is producing multiple div class=“modal-backdrop hide”> in the DOM. Was this intentional?

Here’s an example:

$ionicModal
  .fromTemplateUrl('modal.html', {
    scope: $scope
  })
  .then(function(modal) {
    $scope.modal = modal;
    $scope.modal.show();
  });

Triggering that multiple times and closing each time produces a new DOM element. Even if you do a $scope.modal.remove() on $destroy, it doesn’t help with the situation. Would I need to collect all the modals produced and have them remove() on $destroy? I feel like this should be a given with this framework.


#2

See : https://github.com/driftyco/ionic/issues/602

There are cases where you want to change the state under the modal but keep the modal opened.

Modals are up to the developer to deal with. They are independent, not singletons.


#3

ok, well… just in case someone out there wants to do what I’m trying to do. Here’s a work-around tutorial: Here’s how I manage my singleton modal