javascript - 我正在使用引导模型。但是当我在 js 端调用一个函数时它会关闭,我希望它打开
问题描述
<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;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="color:#FFF;"> <span aria-hidden="true">×</span></button>
<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">
<thead>
<tbody>
<thead>
<tr>
<th class="text-center" style="vertical-align:middle" rowspan="2"></th>
<th class="text-center" style="vertical-align:middle" rowspan="2">Bid SPOC</th>
<th class="text-center" style="vertical-align:middle" rowspan="2">Role</th>
<th class="text-center" colspan="5">SPOC's Availability(Number of Service Requests Per Stage)</th>
</tr>
<tr>
<th><b>Initiation</b></th>
<th><b>SPOC Assignment</b></th>
<th><b>Participant Contribution</b></th>
<th><b>Review</b></th>
<th><b>Closure</b></th>
</tr>
</thead>
<tr ng-repeat="x in infoWithStatus track by $index">
<td align="center"><input type="checkbox" ng-model="infoWithStatus[$index].checked"></td>
<td ng-model="infoWithStatus[$index].name">{{x.name}}</td>
<td>
<select ng-model="infoWithStatus[$index].selectedRole" ng-options="item for item in SPOCroles">
<option value="">Please select a role</option>
</select>
</td>
<td>{{x.count1}}</td>
<td>{{x.count2}}</td>
<td>{{x.count3}}</td>
<td>{{x.count4}}</td>
<td>{{x.count5}}</td>
<tr/>
</tbody>
</thead>
</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>
在这里,我们可以看到我在单击时调用了一个函数,其中包含一些验证。但是,在验证完成后,它会关闭模型。但是,我希望模型在验证后仍然打开。
解决方案
你应该删除
data-dismiss="modal"
从这里
<button type="button" class="btn btn-primary waves-effect waves-light" data-dismiss="modal" ng-click="validate(infoWithStatus)" >Done</button>
如果验证成功,validate(infoWithStatus)
您应该关闭模式。使用下面的代码隐藏模式
$("#responsive-modal3").modal("hide");
推荐阅读
- git - Git 克隆私有 github 仓库
- windows - 如何为不同的项目类型使用相同的字符串资源
- sql - 展平sql分层数据
- java - Java/Scala - 将 xml 转换为 json
- java - 429 gitlab-api 上的请求太多
- javascript - 是否可以在实例化时检测给定类型的所有可调用方法,然后为每个方法动态创建转发过程
- r - 在 R 中安装包会出现以下错误
- visual-studio-code - 如何避免 VSCode 格式化部分代码
- http - 发布请求后如何删除帐户
- android - Firestore:存储架构更多领域或文档?在 Android 传感器应用程序中