Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //on $htttp success...
- var dataRows = data; //data is your array with 2000 items
- var delay = 0; //in milliseconds
- //var to be used in ngRepeat
- $scope.rows = [];
- //each loop will extract the first objects from the array until the array is empty
- while(dataRows.length) {
- delay += 20; //time span between every timeout call
- //using $timeout so it creates a new thread (don't lock UI)
- $timeout(function () {
- //take the first 50 items from the Array
- var thisChunk = dataRows.splice(0, 50);
- //append the 50 items to the $scope var
- $scope.rows.push.apply($scope.rows, thisChunk);
- }, delay);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement