我有一个Angular bootstrap模态。当用户在模态上单击“确定”时,我调用一个角度函数并且函数正常工作,并且根据需要返回,因为我可以看到屏幕在模态后面刷新但控件未返回到父级
这是模态
<div class="modal-content">
<div class="modal-body">
<h4 class="modal-title">Are you sure?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-info"
data-dismiss="modal" ng-click="acknowledge(details.id)">Ok</button>
<button type="button" class="btn btn-info"
data-dismiss="modal">Cancel</button>
</div>
</div>
这是角度函数
$scope.acknowledge = function(jobId) {
var jobId = {
'jobId' : jobId,
'userID' : $scope.user
};
var jobDetail = $resource('modifyJobDetail', jobId);
$scope.jobInfo = jobDetail.query().$promise.then(function(resp) {
$scope.refreshJobDetail();
});
}
$scope.refreshJobDetail = function() {
var users = $resource('refreshJobDetail');
$scope.detail = [];
$scope.userinfo = users.query().$promise.then(function(response) {
$scope.detail = response;
return angular.copy($scope.detail);
});
}
我可以在窗口中看到刷新的字段,但控件不会返回到父窗口。
答案 0 :(得分:0)
我已经在Plunker中调整了您的代码,但我已将$ uibModal.open()返回的承诺存储在控制器范围中,以便我可以在需要时将其关闭:
DateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy Z", Locale.ENGLISH);