This is the companion slides for the AngularJS-IL meetup 9 talk - that took place on January 13 2015 @ Google campus TLV.
Grab the code here: https://github.com/nirkaufman/angularjs-performance-tips
20. TIP# 2
split your code between compile
and link in custom directives
Nir@500tech.com
21. why?
Angular runs the compile function at
loading, but only once. the link function
will run each time the directive is inserted
to the DOM
Nir@500tech.com
23. TIP# 3
prefer using ng-if/switch directive
instead of ng-show/hide
Nir@500tech.com
24. why?
The ng-if directive removes or recreates a
portion of the DOM. which means that the
content won’t be compiled until it visible.
Nir@500tech.com
27. Nir@500tech.com
digest cycle
user event
(ng-click)
tick event
(interval)
server
response
apply or
digest call
start
from root
scope
check all
watchers
on scope
value changed
no change
more
scopes?
switch to scope and
continue checking
all done
update
UI
angular source code, line 13991