From a21920560fb7e5ba6b5b3c6827530779e1dad764 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Wed, 16 Dec 2020 16:48:10 +0100 Subject: [PATCH] Fix autocomplete on enter --- .../autocomplete-select/autocomplete-select.component.html | 2 +- .../autocomplete-select/autocomplete-select.component.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/components/autocomplete-select/autocomplete-select.component.html b/src/app/components/autocomplete-select/autocomplete-select.component.html index e51b5f2..4f528f8 100644 --- a/src/app/components/autocomplete-select/autocomplete-select.component.html +++ b/src/app/components/autocomplete-select/autocomplete-select.component.html @@ -12,7 +12,7 @@ {{ nameToShowInSelection(object) }} diff --git a/src/app/components/autocomplete-select/autocomplete-select.component.ts b/src/app/components/autocomplete-select/autocomplete-select.component.ts index eef16e9..4a8cd97 100644 --- a/src/app/components/autocomplete-select/autocomplete-select.component.ts +++ b/src/app/components/autocomplete-select/autocomplete-select.component.ts @@ -68,13 +68,14 @@ export class AutocompleteSelectComponent implements OnInit { .valueChanges.subscribe(() => this.filterPossibleObjects()); } - onOptionClicked(event: Event, element: any, trigger: MatAutocompleteTrigger) { - event.stopPropagation(); + onOptionSelected(element: any, trigger: MatAutocompleteTrigger) { if (this.keepAutocompleteOpenAfterClick) { trigger.openPanel(); } - this.addForm.get('addGroup').reset(); + this.addForm.get('addGroup').setValue(''); this.selectedElementChange.emit(element); + + this.filterPossibleObjects(); } filterPossibleObjects() {