NgFor
A structural directive that renders a template for each item in a collection. The directive is placed on an element, which becomes the parent of the cloned templates.
class NgFor<T, U extends NgIterable<T> = NgIterable<T>> implements DoCheck {}
ngForOf
(U & NgIterable<T>) | null | undefined
The value of the iterable expression, which can be used as a template input variable.
ngForTrackBy
Specifies a custom TrackByFunction
to compute the identity of items in an iterable.
If a custom TrackByFunction
is not provided, NgForOf
will use the item's object
identity
as the key.
NgForOf
uses the computed key to associate items in an iterable with DOM elements
it produces for these items.
A custom TrackByFunction
is useful to provide good user experience in cases when items in an
iterable rendered using NgForOf
have a natural identifier (for example, custom ID or a
primary key), and this iterable could be updated with new object instances that still
represent the same underlying entity (for example, when data is re-fetched from the server,
and the iterable is recreated and re-rendered, but most of the data is still the same).
ngForTrackBy
ngForTemplate
TemplateRef<NgForOfContext<T, U>>
A reference to the template that is stamped out for each item in the iterable.
ngDoCheck
void
Applies the changes when needed.
void
ngTemplateContextGuard
boolean