Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What does the trackBy function on ngFor do?

  1. A Tracks user analytics
  2. B Tells Angular how to identify items so it can reuse DOM nodes instead of recreating them
  3. C Sorts the list
  4. D Filters the list
Answer

Tells Angular how to identify items so it can reuse DOM nodes instead of recreating them

Without trackBy, changing the array causes Angular to destroy and rebuild every element, which is costly and loses component state.

All Angular MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as