I try to have multiple modal template in index.html cause whole application hang ( freeze )
After i test i found when i put controller for handle business logic it cause browser freeze ( it try to load AngularJS code ) while angular script error random line ( as i show below line 58 some time line 5328 e.g. )
My sample code
modal1
<script id="modal2.html" type="text/ng-template">
<div class="modal">
<header class="bar bar-header bar-positive">
<h1 class="title">test1</h1>
<button class="button button-clear" ng-click="closeModal()">close</button>
</header>
<content has header="true" padding="true">
<button class="button button-clear button-dark" ng-controller="Test1Controller " >
test1
</button>
</content>
</div>
</script>
modal2
<script id="modal2.html" type="text/ng-template">
<div class="modal">
<header class="bar bar-header bar-positive">
<h1 class="title">test1</h1>
<button class="button button-clear" ng-click="closeModal()">close</button>
</header>
<content has header="true" padding="true">
<button class="button button-clear button-dark" ng-controller="Test2Controller " >
test1
</button>
</content>
</div>
</script>
controller
.controller('Test1Modal', function($scope, $ionicModal) {
// Load the modal from the given template URL
$ionicModal.fromTemplateUrl('modal1.html', function(modal) {
$scope.modal = modal;
}, {
// Use our scope for the scope of the modal to keep it simple
scope: $scope,
// The animation we want to use for the modal entrance
animation: 'slide-in-up'
})
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
$scope.modal.hide();
};
})
Modal2 Controller2
.controller('Test2Modal', function($scope, $ionicModal) {
// Load the modal from the given template URL
$ionicModal.fromTemplateUrl('modal2.html', function(modal) {
$scope.modal = modal;
}, {
// Use our scope for the scope of the modal to keep it simple
scope: $scope,
// The animation we want to use for the modal entrance
animation: 'slide-in-up'
})
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
$scope.modal.hide();
};
})