title: Closing all the modal bootstrap pop up in Angular JS
body: <p>I want to close all the modal pop up boxes when a user clicks on a close button of the final confirmation modal popup.</p>
  
  <p>But the modal windows that are open do belong to different controllers. Here is the snippet :</p>
  
  <pre><code>function getQuickCasePopup($scope, $uibModal, $rootScope) {
      var templateUrl = BasePath + 'App/Transaction/Views/common/QuickCaseSearch.tpl.html';
      var controller = 'QuickCaseSearchCtrl';
      OpenModal($scope, $uibModal, null, templateUrl, controller, null, null, '', $rootScope);
  }
  
  function getAddCasePopup($scope, $uibModal, $rootScope) {
      var templateUrl = BasePath + 'App/Transaction/Views/common/CreateCase.tpl.html';
      var controller = 'AddCaseCtrl';
      OpenModal($scope, $uibModal, null, templateUrl, controller, null, null, '', $rootScope);
  }
  
  function getAdvanceCasePopup($scope, $uibModal, $rootScope) {
      var templateUrl = BasePath + 'App/Transaction/Views/common/AdvanceCaseSearch.tpl.html';
      var controller = 'AdvanceCaseCtrl';
      OpenModal($scope, $uibModal, null, templateUrl, controller,null, null, 'lg', $rootScope);
  }
  
  function OpenModal($scope, $uibModal, $stateParams, templ, ctrl, grid, row, size, $rootScope) {
  
      var CssClass = '';
      if (size === 'lg') {
          CssClass = 'app-modal-window';
      }
  
      var ModalInstance = ModalInstance || $uibModal.open({
          animation: $scope.animationsEnabled,
          templateUrl: templ,
          controller: ctrl,  // Logic in instantiated controller 
          windowClass: CssClass
      }); 
  </code></pre>
  
  <p>And the confirmation pop - up code looks like :</p>
  
  <p>$("#iConfirmationModal").modal();</p>
  
  <pre><code>$("#iConfirmationModal").on('hidden.bs.modal', function () {
  
      //$(".app-modal-window").dialog("close"); //Did not work
  
      $state.go('transaction.search', {});
  });
  </code></pre>
  
  <p>So I want to close all the modal pop-ups and then redirect . Can I achieve the same ?</p>