问题描述
我如何使用“ MAT_AUTOCOMPLETE_DEFAULT_OPTIONS”注入令牌来全局配置是否针对角材料中的自动完成组件突出显示面板的第一个元素
[https://material.angular.io/components/autocomplete/api#MatAutocomplete] [1]
解决方法
根据该文档,该选项只有一个-因此只需在需要此选项的地方提供模块即可。
providers: [
{provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,useValue: {autoActiveFirstOption: true}}
]