I have a view that contains multiple modals. This works correctly in chrome and usually works correctly the first time I open and close the modals on an iOS device, however, if I open/close the modal multiple times on device the modal either doesn’t open or takes up to 2 minutes to open.
<li class="item item-toggle">
Religion:
<label class="toggle">
<input type="checkbox" ng-change="toggleReligionModal()" ng-model="searchCriteria.religionRequired">
<div class="track">
<div class="handle"></div>
</div>
</label>
</li>
<li class="item item-toggle">
Language:
<label class="toggle">
<input type="checkbox" ng-change="toggleLanguageModal()" ng-model="searchCriteria.languageRequired">
<div class="track">
<div class="handle"></div>
</div>
</label>
</li>
Controller:
// Load the modals
$ionicModal.fromTemplateUrl('templates/language.html', function (modal) {
$scope.languageModal = modal;
}, {
scope: $scope,
animation: 'slide-in-up'
});
$ionicModal.fromTemplateUrl('templates/religions.html', function (modal) {
$scope.religionModal = modal;
}, {
scope: $scope,
animation: 'slide-in-up'
});
$scope.toggleLanguageModal = function () {
if ($scope.searchCriteria.languageRequired) {
$scope.openLanguageModal();
} else {
$scope.closeLanguageModal();
}
};
$scope.toggleReligionModal = function() {
if ($scope.searchCriteria.religionRequired) {
$scope.openReligionModal();
} else {
$scope.closeReligionModal();
}
};
//Open and close modals
$scope.openLanguageModal = function() {
$scope.languageModal.show();
};
$scope.openReligionModal = function() {
$scope.religionModal.show();
};
$scope.closeLanguageModal = function() {
$scope.languageModal.hide();
};
$scope.closeReligionModal = function() {
$scope.religionModal.hide();
};
Modal View:
<div class="modal">
<header class="bar bar-header bar-positive">
<h1 class="title">Select Language</h1>
</header>
<content has-header="true">
<div class="list">
<label class="item item-radio" ng-repeat="language in languages">
<input type="radio" ng-model="searchCriteria.language" ng-value="language.id">
<div class="item-content">
{{language.name}}
</div>
<i class="radio-icon ion-checkmark"></i>
</label>
<div class="padding-horizontal">
<button class="button button-block button-positive" ng-click="closeLangugeModal()">
Done
</button>
</div>
</div>
</content>
I’ve tried creating separate scopes for the modals but got the same result. I can’t seem to track down this the root cause. Any advice would be appreciated.