I have the following code:
<li *ngFor="let item of serviceList; let i = index;">
<button *ngIf="currentTools contains i" (click)="processService(item)">
Run Service</button>
</li>
Is there any way in Angular 2 to check if an array contains the index of my item?
I basically only want to show the items when their index number is in an array (currentTools), which is dynamically modified in a different process.
<li *ngFor="let item of serviceList; let i = index;">
<button *ngIf="currentTools.indexOf(i)>-1" (click)="processService(item)">
Run Service
</button>
</li>
Try this