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>