Categories
Angular

Angular ng-template, ng-container , ngTemplateOutlet

1- <ng-template> is a template element that Angular uses with structural directives like *ngIf, *ngFor, [ngSwitch] and custom directives
Note: the ng-template directive represents an Angular template

2- <ng-container> We can avoid having to create that extra div, we can instead use ng-container directive

<ng-container *ngFor="let item of items">
   <p *ngIf="item.id">{{item.name}}</p>
</ng-container>

3- *ngTemplateOutlet
We can used as a container to templates that can be reused at multiple places.