hussain hussain - 1 year ago 82
AngularJS Question

How to resolve performance issue using ng-repeat directive?

I see some performance issue using with ng-repeat angular directive, i am receiving alot of data from backend that slow down the application so while receiving data i would not be able to click on anything. What would be the best way to deal with large list using ng-repeat, lets assume 1000 messages per minute ?


$scope.event = [];
socket.on('ditConsumer', function(data) {
var obj = {
file: $scope.filename,
data: data


<ul style="list-style: none;">
<li ng-repeat="message in event track by $index" ng-class="{lastItem: $last}"><span><strong>Log:</strong></span><span>{{message}}</span></li>

Answer Source

first of all use some kind of message id in ng-repeat="message in event track by $index" instead of $index which is rendered each ng-repeat digest. See

second - you can limit visual items with limitTo filter:

ng-repeat="message in event track by | limitTo:100"

hidden items will be still searchable and recoverable by other filters but not rendered in HTML

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download