ng-template and ng-container
Define and host template fragments.
Templates That Do Not Render
<ng-template> defines a chunk of markup that is not rendered until something explicitly instantiates it. It is the foundation of structural directives like *ngIf.
Defining a Template
Content inside <ng-template> stays inert. You give it a reference variable to use it elsewhere.
<ng-template #empty>
<p>No items found.</p>
</ng-template>All lessons in this course
- Single-Slot Content Projection
- Multi-Slot Projection with select
- ng-template and ng-container
- TemplateRef and ViewContainerRef