W3cubDocs

/Angular 11

TrackByFunction

interface

An optional function passed into the NgForOf directive that defines how to track changes for items in an iterable. The function takes the iteration index and item ID. When supplied, Angular tracks changes by the return value of the function.

interface TrackByFunction<T> {
  (index: number, item: T): any
}

Methods

(index: number, item: T): any

Parameters
index number
item T
Returns

any

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/api/core/TrackByFunction