我有每个都带有复选框的列表。复选框上的选择会导致3个不同的其他调用,并且响应会与该列表的HTML绑定。如果用户点击多个复选框的速度非常快,那么后者的响应将覆盖之前的响应(先前的响应仍在响应中,而后者的响应已覆盖上一个响应)通过先前的呼叫响应覆盖Http响应
Eg-如果我选中6个复选框, ,有可能这个响应可能不会被其他呼叫执行。
getRequestRecords: function(obj) {
return $http({
url: $serverPath + '/alumCenter/notifications/request/' +obj',
method: "GET"
});
},
$scope.singleSelectSet=function(obj){
myService.getRequestRecords(obj).then(function(response){
$scope.myVar=response;
// do lots of things
});
}
<div ng-repeat="obj in flats track by $index">
<input type="checkbox" class="selectable" ng-click="singleSelectSet(obj)" ng-checked="showChecked($index)" aria-label="{{:: 'common.slideout.aria.slatSelectCheckboxLabel' | i18n }}">
</div>
这可能是这样的问题:http://stackoverflow.com/questions/35375120/cancelling-ongoing-angular-http-requests-when-theres-a-new-request –
@ThomasGhesquiere:我不想要取消剩余的通话。对我而言这将是错误的。该复选框已被选中。如果其相应的数据不可见,那将是不好的用户体验。 – RahulB
我们不知道如何使用'getRequestRecords()'。显示所有相关代码 – charlietfl