Search Posts

ng-repeat performance – 1300 watchers

I have something like 1300 watchers on ng-repeat, I have to reduce it.
the big problem is that lot of my things in my ng-repeat is 2-way binding because I need to change the list and insert new event to the list every x time and handle functionality in the di

My app is like the following:

get event Obj from server by polling every 3 seconds:

in my controller I get the data:

 vm.eventData  = Server.eventData;

index html:

<event-list
        settings-data ="vm.settings"
        event-data = "vm.eventData"
</event-list>

Event list directive:(handle when there is a new obj to the list and show the list in loading, update by watchcollection when there is new event and update the scope.eventData

 scope.$watchCollection('eventData', function(newVal, oldVal){
}

event-data-directive.html

    <li id="listItem_{{event.id}}" ng-repeat="event in eventsData track by $index">

inside the li, I have a click directive to handle a click and show the event and on click, I need to update the view with the data from the eventsData array

I tried to add bindonce plugin but it is not help because its one way binding and every action in my app affects the event list

So basically I have to reduce the watchers or change all my functionality , what do you think?

thanks

Source: AngularJS

1 comment on ng-repeat performance – 1300 watchers

  1. I have noticed you don’t monetize your website,
    don’t waste your traffic, you can earn additional bucks every month because
    you’ve got hi quality content. If you want to know how to make extra money, search for:
    Mertiso’s tips best adsense alternative

Leave a Reply

Your email address will not be published. Required fields are marked *