I am able to open modal in angular and using ng-show to show and hid the some div. toggling inside the modal, but when i try to close the modal. It just disappears from the page but does not remove itself from html. I can see the modal in browser's inspect element. This HANGS the page. Page becomes unresponsive and I can not click any other button or link on the page. I tried many links but nothing is working. Am I doing any thing wrong. Please help me here. :( Below is my code I am using angular 1.5.6
//my parent controller to call modal
(function () {
var app = angular.module("formModule", ['ngRoute']);
app.controller("formController", function($scope,$http,$rootScope,$location,ModalService) {
$scope.BookNow= function() {
ModalService.showModal({
templateUrl: "views/feature.html",
controller: "featureController"
})
.then(function(modal) {
modal.element.modal();
modal.close.then(function(result) {
console.log(result);
});
});
}
});
})();
// my modal controller
(function () {
var app = angular.module("featureModule", ['ngRoute','ngAnimate']);
app.controller("featureController", function($scope,$http,$rootScope,close,ModalService) {
$scope.fea=true;
$scope.close = function(result) {
ModalService.close(result,500); // close, but give 500ms for
}
$scope.calendar=function() {
$scope.fea=!$scope.fea;
$scope.cal=!$scope.cal;
}
});
})();
<div class="modal fade" id="modala" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" ng-click="close(-1)" aria-hidden="true">×</button>
</div>
<div class="modal-body" ng-show="fea" >
<h2 class="modal-title" id="myModalLabel_3">Select Features</h2>
</div>
<div class="modal-body" ng-show="cal" >
<h2 class="modal-title" class="ss" id="myModalLabel_3">Select Date & Time</h2>
</div>
<div class="modal-footer">
<div class="inner_read_more modal_btn_1">
<a class="showSingle_1" ng-click="calendar()" >Next <i class="fa fa-arrow-circle-right" aria-hidden="true"></i></a>
</div>
</div>
</div>
</div>
</div>