根据MatAutocomplete 文档,MatAutocomplete 类中有一个panel属性可以为您提供面板的 elementRef。
面板:ElementRef
包含自动完成选项的面板元素。
尽管 autocomplete.panel 始终未定义,但我正在努力使其正常工作?我错过了什么?
<mat-autocomplete #auto="matAutocomplete">
  @ViewChild("auto") autocomplete: MatAutocomplete;
  ngAfterViewInit(): void {
    console.log(this.autocomplete.panel); // undefined??
  }