Scope lost on app resume (?)

If I open a modal and then background the app (tested on iOS) and then bring the app back to the foreground - the modal is still displayed but is unresponsive to any touch events. I have to restart the app.

How do I prevent the app from freezing when returning from the background?

Modal presentation:

<ion-modal-view ng-controller="txDetailsController" on-swipe-right="cancel()">
  <nav class="tab-bar" ng-style="{'background':skin.view.navBarBackground}">
    <section class="left-small">
      <a ng-click="cancel()" ng-style="{'color':skin.view.navBarButtonTextColor}">
        <i class="icon-arrow-left3 icon-back"></i>
        <span class="text-back" translate>Back</span>
      </a>
    </section>
    <section class="middle tab-bar-section">
      <h1 class="title ellipsis" ng-style="{'color':skin.view.navBarTitleColor}" translate>
        Transaction
      </h1>
    </section>
  </nav>

  <ion-content class="modal-content">
...
<ion-content>
<ion-modal-view>

To open the modal:

  this.openTxModal = function(btx) {
    var self = this;
    
    $scope.btx = btx;
    $scope.self = self;

    $ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
      scope: $scope,
      backdropClickToClose: false,
      hardwareBackButtonClose: false,
      animation: 'animated slideInRight',
      hideDelay: 500
    }).then(function(modal) {
      $scope.txDetailsModal = modal;
      $scope.txDetailsModal.show();
      $rootScope.modalOpened = true;
    });
  };

I’ve verified that click events are being handled by the ionic framework but that those events are not resulting in callbacks to my scope being made. I’m thinking that perhaps the app is not resuming properly (see http://tripleneo.nl/resume-app-using-angularjs-ionic/). It certainly acts like the modal scope is lost on resume. Any help would be appreciated.

I’ve verified that the scope is retained after the app resumes. Testing in iOS simulator with Safari, if I enter the following into the console the modal is closed as expected.

angular.element($0).scope().cancel()

For some reason events are not being delivered.

I found the cause of the problem but don’t yet understand why this has happened.

In the following function there is no scope.$apply() function. It’s executing an angular.noop().

`.factory(’$ionicNgClick’, [’$parse’, function($parse) {
return function(scope, element, clickExpr) {
var clickHandler = angular.isFunction(clickExpr) ?
clickExpr :
$parse(clickExpr);

       element.on('click', function(event) {
            **scope.$apply(function()** {
                clickHandler(scope, {
                    $event: (event)
                });
            });
        });

        // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click
        // something else nearby.
        element.onclick = noop;
    };
}`

Hi! I have exactly the same problem. Did you find any solution?