JS:
var populateRecord = function(data) {
var chunk = 40;
$scope.users = [];
console.log(data.length + "hi");
for (var i = 0; i < data.length; i += chunk) {
console.log("inside for");
// userCount++;
$scope.users.push(data.slice(i, i + chunk));
// console.log(temp);
}
console.log($scope.users)
};
HTML:
<div ng-repeat="record in users track by $index">
<div class="col-md-2 col-sm-2 col-xs-2">
<label>
<input type="checkbox" ng-model="isAllSelected" ng-change="userSelectedToggle()" ng-checked="isAllRecordSelected(record)">
</label>
</div>
<div class="col-md-6 col-sm-6 col-xs-6">
<div class="text-overflow">
<span ng-model="record.dispalyName">{{record.displayName}}</span>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<span ng-model="record.mobile"> {{record.mobile}}</span>
</div>
</div>
在&quot; populateRecord&#39;之后在控制台上输出 2里面的 2 [array(40),array(7)]
现在首先我要显示40个元素,点击按钮后,第二个数组应显示在屏幕上。任何解决方案?
答案 0 :(得分:1)
您只需要保留一个计数器,并在点击按钮发布时将用户数组的索引增加一,并将其存储在一个新数组中,该数组将用于呈现UI。
<强> JS 强>:
var counter=0;
$scope.sendBulkMessages=function(){
counter=counter +1;
//do your calculations with $scope.parent before assigning it to next 40 elements
$scope.parent=$scope.users[counter];
console.log($scope.parent);
}