• Overview
@angular/core

TemplateRef

Class

Represents an embedded template that can be used to instantiate embedded views. To instantiate embedded views based on a template, use the ViewContainerRef method createEmbeddedView().

  
    abstract class TemplateRef<C> {}
  
  

elementRef

The anchor element in the parent view for this embedded view.

The data-binding and injection contexts of embedded views created from this TemplateRef inherit from the contexts of this location.

Typically new embedded views are attached to the view container of this location, but in advanced use-cases, the view can be attached to a different container while keeping the data-binding and injection context from the original location.

createEmbeddedView

Instantiates an unattached embedded view based on this template.

@paramcontextC

The data-binding context of the embedded view, as declared in the <ng-template> usage.

@paraminjectorInjector | undefined

Injector to be used within the embedded view.

@returnsEmbeddedViewRef<C>
Jump to details