Answers for "difference between ng-container and ng-template"

0

ng-container vs ng-template

<div>
  Pick your favorite hero
  (<label><input type="checkbox" checked (change)="showSad = !showSad">show sad</label>)
</div>
<select [(ngModel)]="hero">
  <ng-container *ngFor="let h of heroes">
    <ng-container *ngIf="showSad || h.emotion !== 'sad'">
      <option [ngValue]="h">{{h.name}} ({{h.emotion}})</option>
    </ng-container>
  </ng-container>
</select>
Posted by: Guest on January-11-2021
0

difference between ng-container and ng-template

<ng-container *ngFor="let item of items; let i = index; trackBy: trackByFn">
  <li>...</li>
</ng-container>
Posted by: Guest on October-19-2021
0

difference between ng-container and ng-template

<li *ngFor="let item of items; let i = index; trackBy: trackByFn">...</li>
Posted by: Guest on October-19-2021
0

difference between ng-container and ng-template

<template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
  <li>...</li>
</template>
Posted by: Guest on October-19-2021

Browse Popular Code Answers by Language