To implement this functionality in an HTML file:
<div *ngFor="let item of list">
<div *ngIf="item.id == matchWithCondion ?func():false">
Add your customized code here
</div>
</div>
Initialize a variable in the typescript file like so:
let isFirstMatch = false;
constructor(){}
func() {
if (!isFirstMatch) {
this.isFirstMatch = true;
return true;
} else {
return false;
}
}
In the HTML file again:
<div *ngFor="let item of list">
<div *ngIf="item.id == matchWithCondion ? func() : false">
Add your custom code here
</div>
</div>
Remember to initialize the 'isFirstMatch' variable in the typescript file:
let isFirstMatch = false;