$watch optimizations ● single $watch is fast actually… ● deep $watch is slow, don’t overuse it $scope.$watch("collection", fn, true); ● Use $watchCollection instead of deep $watch $scope.$watchCollection("collection", fn); Note: {{ expression }} ←→ $scope.$watch("expression", fn); 5
track by ● ng-repeat always clears DOM by default ● track by prevents recalculating DOM for known values Mostly can’t use one-time binding and track by at once 11
ocLazyLoad 21 ● Less data to load on start ● Low cost of loading new modules ● Memory consumption PROFIT ● Workaround for Angular 1.x ● Adding new modules is painful* * Different strategy for production and local development