Open matAutocomplete with open openPanel() method

前端 未结 3 894
谎友^
谎友^ 2020-12-30 02:41

I\'m working with Angular Material\'s matAutocomplete component, and according to the docs, there is a method which can open/close an autocomplete panel with a openPanel()/c

3条回答
  •  情书的邮戳
    2020-12-30 02:58

    in template

    
    
    
    

    in ts

    @ViewChild(MatAutocompleteTrigger, {read: MatAutocompleteTrigger}) inputAutoComplete: MatAutocompleteTrigger;
    
    
    openPanel(evt): void {
      evt.stopPropagation();
      this.inputAutoComplete.openPanel();
    }
    

提交回复
热议问题