0
我可以打开角度模式,并使用ng-show来显示和隐藏某些div。在模态内切换,但是当我尝试关闭模态时。它只是从页面中消失,但不会从html中移除。我可以在浏览器的检查元素中看到该模式。这吊起了页面。页面无响应,我无法点击页面上的任何其他按钮或链接。我尝试了很多链接,但没有任何工作。我做错了什么吗?请在这里帮助我。 :(下面是我的代码,我使用的角度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>