ngIf property

  1. @Input()
void ngIf=(bool newCondition)

Whether the content of the directive should be visible.

Implementation

@Input()
set ngIf(bool newCondition) {
  // Legacy support for cases where `null` is still passed to NgIf.
  newCondition = newCondition == true;
  if (!checkBinding(_prevCondition, newCondition)) {
    return;
  }
  if (newCondition) {
    _viewContainer.createEmbeddedView(_templateRef);
  } else {
    _viewContainer.clear();
  }
  _prevCondition = newCondition;
}