以编程方式打开垫选择

时间:2020-04-13 12:59:16

标签: angular typescript angular-material

我的代码中有很多选择垫的选项,并且每个旁边都有一个箭头图标来切换选择垫面板

<mat-select disableOptionCentering panelClass="my-mat-select">
    <mat-option *ngFor="let state of states" [value]="state">{{state}}</mat-option>
</mat-select>
<img class="... " (click)="toggle_select_tab($event.target)" src="assets/icons/arrow-down.png" alt="arrow-down">
______________________________________________________________________________________

toggle_select_tab(arrow_element) {
      this.select_tab = arrow_element.previousSibling; //
      this.select_tab.open() // error : this.select_tab.open is not a function
    }
  }

我将不使用View Child,因为我必须为每次选择的垫子指定ID

0 个答案:

没有答案