What is the use of the ng-repeat directive and how do you optimize its performance?

Instruction: Explain the purpose of ng-repeat and discuss techniques for improving its rendering performance.

Context: This question tests the candidate's knowledge of creating dynamic lists in AngularJS and their ability to enhance performance in data-intensive scenarios.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

ngRepeat instantiates a template for items in a collection, with a scope for each repeated instance. Work comes from both collection tracking and the bindings/directives inside each row, so “one watcher per item” is not an adequate cost model.

For records with stable unique IDs, this template fragment makes identity explicit:...

Related Questions