我一直在使用bootstrap对话框,我非常喜欢它。代码如下。
function resolveTicket(itemId) {
//return dataservice.remedy.resolveTicket(itemId, 'test').then(function (data) {
// log('Resolved tkt ' + itemId + ' by ' + config.user);
//});
var dialog = new BootstrapDialog({
title: 'Resolve ' + itemId,
message: '<textarea id="txtMessage" name="txtMessage" rows="5" cols="71"></textarea>',
draggable: true,
buttons: [{
label: 'Resolve',
cssClass: 'btn-primary',
action: function (dialogref) {
dialogref.close();
var closureComments = dialogref.getModalBody().find('textarea').val();
return dataservice.remedy.resolveTicket(itemId, closureComments).then(function (data) {
log('Resolved tkt ' + itemId + ' by ' + config.user);
});
}
}, {
label: 'Close',
cssClass: 'btn-primary',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
dialog.realize();
dialog.getModalHeader().css('background-color', 'rgb(44, 62, 80)');
dialog.open();
}
<ul class="list-unstyled item-list">
<li ng-repeat="r in vm.remedyTickets | orderBy:'CreatedDate' ">
<span class="item rt">
<!--Row 1-->
<div class="itemRow">
<div class="r1l">
<span>{{r.FullName}}</span>
</div>
</div>
<!--Row 2-->
<div class="itemRow">
<div class="r1l">
<span class="ticketNumText">{{r.TaskId}}</span>
<a class="btn btn-xs disabled ticket-{{r.StatusId}}">{{r.StatusId}}</a>
</div>
<div class=" r1r quickActions">
<span class="small glyphicon glyphicon-trash" title="Resolve/Close the ticket" data-ng-click="vm.resolveTicket(r.TaskId);$event.stopPropagation();"></span>
</div>
</div>
</span>
</li>
</ul>
“解决”按钮可解析故障单并将状态更新为“已解决”。到目前为止工作得很好。
今天我在ng-repeat中引入了一个过滤器,如下所示。
<li ng-repeat="r in vm.remedyTickets | orderBy:'CreatedDate' | filter: { StatusId: '!Resolved'} ">
我的期望是,只要我解决了故障单(通过打开对话框并单击“解锁”按钮),状态就会变为“已解决”,并且故障单应该远离ng-repeat。
如果我将解析票放在上面的引导程序对话框中,则无效。故障单已解决,状态更新为“已解决”但仍处于ng-repeat状态。
如果我更改下面的javascript,它会起作用,即,一旦我解决了这张票,它就会消失。
function resolveTicket(itemId) {
return dataservice.remedy.resolveTicket(itemId, 'test').then(function (data) {
log('Resolved tkt ' + itemId + ' by ' + config.user);
});
}
问题在于BootStrapDialog + angularjs过滤器
任何想法/替代方案?