I am trying to bind an array element from a class to an option tag.
In the angular.io "Tour of Hero" tutorial ( https://angular.io/docs/ts/latest/tutorial/toh-pt2.html ) they do the following for a list :
<li *ngFor="let hero of heroes"
(click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
If I understand it right the *ngFor="let hero of heroes" will associate each hero ( so each element in the heroes array ) to a li element and then display some caracteristics of the associated hero with {{hero.id}} for example.
I say associate because if it was just a simple loop with a print I don't see how they would get back the hero object after with onSelect(hero).
I have been trying to do the same with option :
<option *ngFor="let perso of persos">
<span>{{perso.id}} : </span> {{perso.nom}}
</option>
But
(click)="onSelect(hero)"
isn't effective since then click event isn't triggered with option. I couldn't find the right trigger. Any help and additionnal information is very welcomed.