I'm using custom material autocomplete input for select items in my dynamic form component. As I said fields of form are dynamic and to filter items list I have to change the list every time user type somethin in the input.
filteredOptions: { [key: string]: Observable<PickListItem[]> } = {}; key is the name of controlName and PickListItem is list of items to the select.
In some case user can add theri own option to the list, after that there is API request that returns updated list of items and here is my problem: I want to replace old list with the new one (updated).
Can someone help me?
this.componentsApiService.addPicklistItem(field.Attributes.List.ID, this.addInputOption)
.pipe(
finalize(() => {
this.store.dispatch(new StopLoading('shared.saving'));
}),
takeUntil(this.componentDestroyed$))
.subscribe( result /*updated list*/ => {
this.filteredOptions[field.Label] = <= here I want to assign observable updated list, dont know how to do this
this.addInputOption = '';
}, ({error}) => {
this.snackBarService.error(error.message);
});