我有一个模态,我试图从控制器关闭 - 但我无法这样做
<button type="button" class="add-entry-btn-group" data-animation="am-fade- and-slide-top" data-template-url="states/../numbersModal.html" bs- modal="modal">New</button>
模态HTML - &gt; numbersModal.html -
<div class="modal" id="addNumbersModal" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="addNumbersModal"
data-animation="am-fade-and-scale" data-placement="center" >
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form method="POST" class="form-horizontal group-border-dashed" name="addNumbersForm" novalidate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
<h4 class="modal-title"> ID Numbers</h4>
</div>
<button class="btn btn-default" type="button" ng-click="closeIdNumbersModal()">
<span class="glyphicon glyphicon-remove"></span> Close</button>
<button type="button" class="btn btn-default" type="reset" ng-click="idNumbers.closeIdNumbersModal()" data-dismiss="modal">Cancel</button>
<button type="submit" ng-click="idNumbers.saveIdNumbers()" class="btn btn-primary">Save</button>
控制器 - &gt;
function closeIdNumbersModal() {
//tried all these things - none works
vm.addIdNumbersModal.$promise.then(vm.addIdNumbersModal.hide);
vm.addIdNumbersModal.close;
vm.addIdNumbersModal.hide;
vm.addIdNumbersModal.hide;
}
答案 0 :(得分:0)
这些看起来像Bootstrap modal classes。
如果是这样,那么你可以使用JQuery(它是bootstrap.js的依赖项)来关闭它们:
$('#addNumbersModal').modal('hide');