select-option loop at myComponent.html:
<select class="form-select" (change)="selectOption($event)">
<option *ngFor="let entity of entities; let i = index"
value="{{entity.id}}" [selected]="i == 0 ? true : null"
(onload)="fooFunction(i, entity.id)">{{entity.name}}
</option>
</select>
and myComponent.ts function:
fooFunction(i: number, entityId: number){
console.log(`${i} - ${entityId}`);
}
I want to pass variables to function while populating options. I tried load , onload , onSelect etc.
How can I achieve this in angular13?