我有一个模式弹出窗口,可以通过单击按钮打开。不幸的是,只有在浏览器中第一次提交弹出窗口时,我才能看到弹出窗口。但是一旦打开和关闭弹出窗口,我就可以通过单击下一次尝试打开模态。如果我刷新浏览器也会发生同样的情况。这看起来很奇怪。任何人都可以解释,为什么?我有以下代码,
按钮html:
<div><button class="btn btn-danger btn-sm" ng-disabled="{{update_problem_description_disabled}}" ng-click="siverifyAddReviewModal()"><i class="glyphicon glyphicon-edit"></i> Edit Review </button>
</div>
模态html:
<div class="modal-header container-fluid">
{% include "siverify_modal_header.html" %}
</div>
<form class="well form-horizontal" name="addReviewForm">
{% csrf_token %}
<div id="form-modal-body" class="modal-body">
{% verbatim %}
<table class="table" style="width:90%">
<tr>
<th><label>Review Title/Purpose*</label></th></br>
{% endverbatim %}
<td><input type="text" class="col-md-10" maxlength="256" ng-model="arform.revtitle" value="arform.revtitle" required/></td>
<!--<td><input type="text" class="col-md-10" maxlength="256" ng-init="'{{reviewtit}}'" ng-model="arform.revtitle" > {{reviewtit}} </td>-->
</tr>
<div class="modal-footer">
<button type="submit" class="btn btn-primary"
ng-disabled="addReviewForm.$invalid || rev_submit_disabled"
ng-click="addReview(arform)">Save</button>
<button type="button" ng-click="cancel()"
class="btn btn-small btn-warning">Cancel</button>
</div>
</form>
模态功能
$scope.siverifyAddReviewModal = function(wpts,mask,lyr,tech) {
// function to open modal and link to Modal Controller
$scope.addRevModal = function(wptSet) {
context = $scope.get_problem_stmt_context(dtWorklist, context_getter);
//console.log("dtw", dtWorklist);
var modalInstance = $modal.open({
backdrop: 'static',
templateUrl: '{% url 'siverify_add_review' %}',
controller: 'SiVerifyAddReviewController',
resolve:{
r_header: function(){ return wptSet; },
context: function(){ return context; }
}
});
modalInstance.result.then(function () {
datatable_worklist.refresh();
$log.info('Modal success');
//console.log(msg);
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
//End:function to open modal and link to Modal Controller