How to limit selection via first letter of the option in mat select?

140 views
Skip to first unread message

Manu Mohanan

unread,
Feb 15, 2021, 2:26:58 PM2/15/21
to angular-material2
Hi Everyone,

I have a mat-select select box which has options as below 

[{ label: Excellent, keyCode:A, id:1 }, { label:Very Good, keyCode:B, id:2 }, { label:Bad, keyCode:C id:3 }, ]

The selection of the options should be based on only the keyCode. The problem is that the interface seems to allow both the short cut key and the first letter of the option labels as short cut options. Currently, the selection is implemented by a function call onKeyPressed on (keydown) of the mat-select. Is there anything possible to stop the selection via the first letter of the option labels. Thanks in advance.

material version : @angular/material": "^9.2.4", angular : 9

Reply all
Reply to author
Forward
0 new messages