I have a huge dataset of several thousand rows with around 10 fields each, about 2MBs of data. I need to display it in the browser. Most straightforward approach (fetch data, put it into $scope
, let ng-repeat=""
do its job) works fine, but it freezes the browser for about half of a minute when it starts inserting nodes into DOM. How should I approach this problem?
One option is to append rows to $scope
incrementally and wait for ngRepeat
to finish inserting one chunk into DOM before moving to the next one. But AFAIK ngRepeat does not report back when it finishes "repeating", so it's going to be ugly.
Other option is to split data on the server into pages and fetch them in multiple requests, but that's even uglier.
I looked through Angular documentation in search of something like ng-repeat="data in dataset" ng-repeat-steps="500"
, but found nothing. I am fairly new to Angular ways, so it is possible that I am missing the point completely. What are the best practices at this?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…