this is my select in html :
<select id="editProfileForm:AttributesList"
name="editProfileForm:AttributesList"
size="6" class="allLists"
[(ngModel)]="atr1" >
<option *ngFor="#attr of attributes"(click)="onSelect(attr, attr.domainDiscrete)">
{{attr.name}}
</option>
</select>
this is my code in component :
onSelect(attclickname: Attribut, statusDiscret: boolean)
{
this.selectedAttr = attclickname;
this._discret = statusDiscret;
}
when I click on the option elements (ie the attribute name), I get the operators and values of this attribute, I want the first option or click Default
答案 0 :(得分:0)
<option>
元素不会触发click
事件。您需要在(click)
元素上应用<select>
绑定。