Samithra niroshana
Samithra niroshana

Reputation: 67

How to bind mousehover event to select option in angular

I have a list of sound, the requirement is relevant sound should play when the mouse hover on the sound name in the list.

  <select class="cc-select-dropdown form-control" id="defaultMerge"      formControlName="DefaultNotificationAlert">
        <option *ngFor="let option of soundList" (mouseover)='playSound()'   [ngValue]="option">{{option}}</option>

The problem is I couldn't find any event that works with the select options

Upvotes: 1

Views: 349

Answers (2)

Zubeyr
Zubeyr

Reputation: 79

you can't do it in the <option> of the <select> tag. But you can do it with <mat-select>, just use (mouseover) in <mat-option>.

Upvotes: 0

Tachibana Shin
Tachibana Shin

Reputation: 3898

you can't catch events like that in <option> it's up to the browser. if you want you have to write a custom dropdown yourself

Upvotes: 1

Related Questions