“NgtemplateOutlet” Kode Jawaban

NgtemplateOutlet

<!-- Alternative syntax -->
<ng-container
  *ngTemplateOutlet="optionTemplate; context:{ $implicit: option, idx: i }"
></ng-container>
><Copy
Scary Salamander

NgtemplateOutlet

<ng-template #optionTemplate let-option let-position="idx">
  {{ position }} : {{option}}
</ng-template>

<!-- client-one.component.html --><>Copy
Scary Salamander

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
Scary Salamander

Jawaban yang mirip dengan “NgtemplateOutlet”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya