Let's say I have following img tag:
<img *ngFor="let icon of icons" [src]="item.imageSrc">
Where icons is array of Icon objects:
export class Icon {
name;
imageSrc;
description;
}
I need to handle event on this img tag element and I would like to see in the event also the object icon. I have some ideas - for example just creating Component, or filtering list by name which is unique with changing a little bit html code to:
<img *ngFor="let item of icons" [src]="item.imageSrc" [name]="item.name" >
However I feel it's not proper way for this issue. Can i give a property to img tag that will store this object?