Use trackBy in Angular ngFor Loops and MatTables
Angular Logo (CC-BY 4.0 by Angular Team press Kit: https://angular.io/presskit).Read more →Note: This article was written for the old
*ngForsyntax, whentrackBy(calledtrackin the new@forsyntax) was optional. For much of the same reasons outlined in this post,trackin the a@fortemplate is required.In most cases,
TrackByFunctionis no longer needed with the new syntax, since the example mentioned in this article could simply be written in the template as:



