1

I have tried to delete all the items in the option list of mat-autocomplete by using the following approaches and similar ones, but although the value in the text field is cleared, the list items still present on the list. Ho can I completely clear this list?

this.inputControl[id].setValue(''); // clear via form control (it just clear input field)

this.filteredOptions = []; // clear via filteredOptions parameter of mat-autocomplete

this.options = []; // tried to set the option value to empty 

I also look at the API, but there is not such a kind of feature unfortunately :(

Jack
  • 1
  • 21
  • 118
  • 236
  • Setting the binded value `this.options = null` to null does not work? Maybe worth closing(via `closePanel()`) the auto complete after setting the value to null as well? – Ronnel Jan 20 '21 at 05:34
  • I tried, but after setting options as null, then I will not get these options later. – Jack Jan 20 '21 at 08:12
  • Well, you kinda want to re-set it right. – Ronnel Jan 21 '21 at 05:49

0 Answers0