angular ng-template ngTemplateOutlet code example
Example 1: ngtemplateoutlet
<li *ngFor="let item of items; index as i">
<!-- Setting the option as the $implicit property of our context along with the row index -->
<ng-container
[ngTemplateOutlet]="optionTemplate"
[ngTemplateOutletContext]="{ $implicit: option, idx: i }"
></ng-container>
</li>
<!-- selector.component.html --><>Copy
Example 2: ngtemplateoutlet
<!-- Alternative syntax -->
<ng-container
*ngTemplateOutlet="optionTemplate; context:{ $implicit: option, idx: i }"
></ng-container>
><Copy