<div *ngFor="let item of items; index as i">
<table *ngIf="i == indexArray">
温温酱
浏览 97回答 3
3回答
慕运维8079593
您可以使用.indexOf(i)并检查它是否在您的indexArray变量中。<div *ngFor="let item of items; index as i"> <table *ngIf="indexArray.indexOf(i)> -1"> <!-- REST OF THE CODE -->
您可以执行以下操作:<div *ngFor="let item of items; index as i"> <table *ngIf="indexArray.includes(i)"> enter code here... </table></div>这是一个工作示例
像这样创建索引数组public indexArray: array = [454,640];像下面那样做。<div *ngFor="let item of items; index as i"> <table *ngIf="indexArray.indexOf(i)> -1"> enter code here... </table></div>如果您有任何疑问,请告诉我。