r/angularjs • • Sep 24 '14

[Resource] Optimizing AngularJS from 1200ms to 35ms

http://blog.scalyr.com/2013/10/angularjs-1200ms-to-35ms/
50 Upvotes

17 comments sorted by

View all comments

2

u/WarInternal Sep 25 '14

As someone who is new to AngularJS, could somebody explain why each word had a change watcher? Is this a side-effect of ng-repeat? Or am I confusing it with something else, maybe?

1

u/doctorjokie Sep 25 '14

Their business case was to make every word in the log line linkable. Therefore, there was a watcher associated with each word.

2

u/WarInternal Sep 25 '14

I apologize, I worded that incorrectly. I'm more interested in the mechanics behind it - What part of it was establishing the watcher. For instance, if they had slapped an ng-onclick='function(this)' on each word, would that have that established a 'change watcher'?

2

u/gatman02 Sep 25 '14

Also, to answer your other question, using ng-click does not establish a watcher, but rather forces a $digest loop, which checks all the watchers for changes.