ngTemplateOutlet property

  1. @Input()
void ngTemplateOutlet=(TemplateRef? templateRef)

The TemplateRef used to create the embedded view.

Any previously embedded view is removed when templateRef changes. If templateRef is null, no embedded view is inserted.

Implementation

@Input()
set ngTemplateOutlet(TemplateRef? templateRef) {
  final insertedViewRef = _insertedViewRef;
  if (insertedViewRef != null) {
    _viewContainerRef.remove(_viewContainerRef.indexOf(insertedViewRef));
  }
  if (templateRef != null) {
    _insertedViewRef = _viewContainerRef.createEmbeddedView(templateRef);
  } else {
    _insertedViewRef = null;
  }
}