HTML:
<div id="responsive-modal3" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none; " data-keyboard="false" data-backdrop="static" ng-init = "populateBidSpocData()" >
<div class="modal-dialog modal-lg">
<div class="modal-content" style="margin-top:55px;">
<div class="modal-header" style="background:#003c4c;">
<h4 class="modal-title" style="color:#FFF;">Check Availibility</h4>
</div>
<div class="modal-body">
<table class="table table-hover hd-bg-table table-bordered">
<!-- Some code -->
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary waves-effect waves-light" data-dismiss="modal" ng-click="validate(infoWithStatus)" >Done</button>
<button type="button" class="btn btn-primary waves-effect waves-light" data-dismiss="modal" >Close</button>
</div>
</div>
</div>
</div>
JS code:
$scope.validate = function(infoObject)
{
//some validation
if(check1 == 0)
{
alert("Please select atleast one value.");
$scope.selected = [];
return;
}
if(primaryCount > 1)
{
alert("There can be only one person with this role.");
$scope.selected = [];
return;
}
//I want to close the modal here if validations are met
//I have tried this
$('#responsive-modal3').modal('hide'); //This is not closing the modal
}
我想从Javascript端关闭模式。我已经尝试了模态(&#39;隐藏&#39;),但它不起作用。相反,它给了一些黑暗的背景。有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
很抱歉将其添加为答案,因为我没有足够的回复评论。我的第一个问题是,是否有任何javascript错误?如果是,则将其添加到问题中。我对角度不是很好,但我对js和bootstrap很好。我尝试了确切的代码,它隐藏了模态。您可以调试角度验证代码以查看验证是否已完成。