December 2014
Intermediate to advanced
346 pages
6h 14m
English
An extremely common pattern in an AngularJS application is to have an ng-repeat directive instance spit out a list of child directives corresponding to an enumerable collection. This pattern can obviously lead to performance problems at scale, especially as directive complexity increases. One of the best ways to curb directive processing bloat is to eliminate any processing redundancy by migrating it to the compile phase.
Suppose that your application contains the following pseudo-setup. This is what we need for the next section:
(index.html) <div ng-repeat="element in largeCollection"> <span my-directive></span> </div> (app.js) angular.module('myApp', []) .directive('myDirective', ...Read now
Unlock full access