I am using mat-autocomplte
with displayFn
& async
pipe.
this.genericAutoComplete$ = this.acFormControl.valueChanges.pipe(
startWith(''),
debounceTime(400),
distinctUntilChanged(),
switchMap(value => {
if (value && typeof (value) === "string" && value.length > 2) {
return this.searchData(value);
} else {
return of(null);
}
})
);
Now my issue is that when i select option from list valueChange
will be called & as i am using displayFn value will be object so else
block will be executed which returns of(null)
;
What i want to do is display previously returned/existing list on focus/click of auto-complete.
So list should not get clear when i select option.
I am not sure how to do that. Can anyone point me in the right direction?