These are chat archives for angular/angular.js
each directive creates a watcher
@relentless-coder, that is not true. (Although
ngRepeat may create one, most directives don't).
If the array is static, you can use one-time bindings which don't create a watcher.
which in turn creates a digest loop
also, not true. It possibly creates a watcher. The number of digests won't change - only the number of watchers checked during each digest.
If you have too many digest loops then your website may slow down, no, it will slow down.
I assume you meant to say "too many watchers". It definitely doesn't help to have many of them, but what is more important is how "heavy" they are. 10000 super-light watchers are faster than 100 slow ones. So, it depends.
ngRepeatwith a one-time binding. The only drawback of this vs hard-coding the elements is that there is slight initial setup cost. In most cases this is neglible (unless you have a very long array). If you are too concerned about the initial rendering speed and you find the cost to be noticeable, hard-code the elements. (In most apps, it won't be an issue.)