0

My web application is huge and I often use ng-repeat to get list of datas. This leads slow performance, sometimes very annoying. I know different ways to avoid the ng-repeat but these ways suggests to use the One-time binding trick! I can't do it because my application needs to get the datas always updated. So, is there any other way to speed up the ng-repeat? I'm still using a pagination to display my datas by the way. Thanks

daan.desmedt
  • 3,752
  • 1
  • 19
  • 33
Atlas91
  • 5,754
  • 17
  • 69
  • 141
  • Can you please post some relevant code example? Just to see the way you are fetching data and gluing it to the view... – daan.desmedt Oct 10 '17 at 15:13
  • Possible duplicate of [what is the difference between ng-bind vs one time binding in angular](https://stackoverflow.com/questions/33480548/what-is-the-difference-between-ng-bind-vs-one-time-binding-in-angular) - answer shows one time binding, one way binding, and two way binding. – Jordan.J.D Oct 10 '17 at 18:17
  • 1
    If you are using nested ng-repeats and filters it can drastically slow down your app (depends on number of watchers). @ShayanKhan is one of easiest solutions you can get. – J. Kovacevic Oct 10 '17 at 20:53
  • Did my answer work? If so, please select it as a valid one – Sean May 19 '20 at 11:22

1 Answers1

2

First, use <div ng-repeat x in objects track by $index> Then, use :: (exactly as shown) for the variables where you don’t want two way binding.

Something like:

{{::object.name}}

I’m on a phone so can’t give you the exact syntax.

Let me know if you can’t get it to work and i’ll give you the exact syntax.

Jordan.J.D
  • 7,999
  • 11
  • 48
  • 78
Sean
  • 1,151
  • 3
  • 15
  • 37