How to use Angular Material MAT_AUTOCOMPLETE_DEFAULT_OPTIONS injection token

后端 未结 2 1867
情话喂你
情话喂你 2021-01-18 07:03

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 ot

2条回答
  •  野的像风
    2021-01-18 07:09

    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.

提交回复
热议问题