Chrome Extension

angular code snippets

ngFor index in Angular
//IF YOU ARE USING ANGULAR > 2
<ul>
    <li *ngFor="let item of items; let i = index">
        {{i}} {{item}}
    </li>
</ul>

//IF YOU ARE USING ANGULAR = 1
<ul>
    <li *ngFor="#item of items; #i = index">
        {{i}} {{item}}
    </li>
</ul>
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>
For loop Angular
<div *ngFor="let item of items">
    <span>{{item.name}}</span>
    <span>{{item.description}}</span>
</div>