What is the way to use the MAT_AUTOCOMPLETE_DEFAULT_OPTIONS injection token, or the const AUTOCOMPLETE_OPTION_HEIGHT to customize mat-autocomplete. These constants, among others are exposed in the public API here but no documentation on how to use them
The <mat-autocomplete>, an Angular Directive, is used as a special input control with an inbuilt dropdown to show all possible matches to a custom query. This control acts as a real-time suggestion box as soon as the user types in the input area.
A simple way to display the selected autocomplete value in an input field.
You can remove the formControl-binding from your input and when you select an option you set that id to your form. You are already calling such a function (onSelectionChange)="onEnteredAccount(accountOption)" in which you can do that.
Add MAT_AUTOCOMPLETE_DEFAULT_OPTIONS
to your module's providers
array like this:
providers: [
// ...
{provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: {autoActiveFirstOption: false}}
]
As for the other constants, I'm not sure you can adjust them. You'll probably have to play around with the CSS styles, see for instance this issue for adjusting the panel height.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With