angular

ngIf + ngFor

<ng-container *ngFor="let product of products;">
  <ng-container *ngIf="product.isInStock">
    <div class="my-class">
      Name: {{product.name}}
    </div>
  </ng-container>
</ng-container>

Angular doesn't allow having both *ngFor and *ngIf for a single element. So, better to have them separate like this.

Was this helpful?