ngIf 数组包含索引
ngIf array contains index
我有以下代码:
<li *ngFor="let item of serviceList; let i = index;">
<button *ngIf="currentTools contains i" (click)="processService(item)">
Run Service</button>
</li>
Angular2 中有什么方法可以检查数组是否包含我的项目的索引?
我基本上只想显示索引号在数组 (currentTools) 中的项目,该数组在不同进程中动态修改。
<li *ngFor="let item of serviceList; let i = index;">
<button *ngIf="currentTools.indexOf(i)>-1" (click)="processService(item)">
Run Service
</button>
</li>
试试这个
我有以下代码:
<li *ngFor="let item of serviceList; let i = index;">
<button *ngIf="currentTools contains i" (click)="processService(item)">
Run Service</button>
</li>
Angular2 中有什么方法可以检查数组是否包含我的项目的索引?
我基本上只想显示索引号在数组 (currentTools) 中的项目,该数组在不同进程中动态修改。
<li *ngFor="let item of serviceList; let i = index;">
<button *ngIf="currentTools.indexOf(i)>-1" (click)="processService(item)">
Run Service
</button>
</li>
试试这个