I have a mat-autocomplete component with the options wired up to be populated from a service call as the user types (partial search):
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="areaSelected($event.option.value)">
<mat-option *ngFor="let option of options" [value]="option">{{ option }}</mat-option>
</mat-autocomplete>
In my TS code, I am setting the options array to be an empty array at the end of the processing I do when a user selects a value:
resetFetchedOptions() {
this.options = [];
}
This works in that the code is called, and that this.options is set to an empty array. The problem is that when the user tries to type another value in the field, the previous options are still there. If they type, the options get cleared out, and the new options based on the partial search are populated, so I think this is a rendering problem, but I'm a bit new to Angular Material, so I'm not sure if this is the wrong approach or I'm missing a step.
Thanks!