ngtemplateoutlet
<!-- Alternative syntax -->
<ng-container
*ngTemplateOutlet="optionTemplate; context:{ $implicit: option, idx: i }"
></ng-container>
><Copy
3.6
10
<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
Thank you!
10
0
3
1
<ng-template #optionTemplate let-option let-position="idx">
{{ position }} : {{option}}
</ng-template>
<!-- client-one.component.html --><>Copy
Thank you!
1
0
0
0
<!-- Define our template -->
<ng-template #myTemplate> World! </ng-template>
Hello
<!-- Render the template in this outlet -->
<ng-container [ngTemplateOutlet]="myTemplate"></ng-container>
<>Copy
Thank you!
0
0
Are there any code examples left?
New code examples in category Other