W3cubDocs

/Angular 10

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–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v10.angular.io/api/core/TrackByFunction