ngForIdentityOf property

  1. @Input()
set ngForIdentityOf (Iterable<T>? elements)

Implementation

@Input()
set ngForIdentityOf(Iterable<T>? elements) {
  _container.clear();
  if (elements == null || elements.isEmpty) {
    return;
  }
  var i = 0;
  for (final element in elements) {
    final view = _container.createEmbeddedView(_template);
    view.setLocal(r'$implicit', element);
    view.setLocal(r'index', i++);
    // TODO: Consider if we want all of the NgFor local variables available.
  }
}