Fix autocomplete on enter

master
Max Ehrlicher-Schmidt 4 years ago
parent 100f53100d
commit a21920560f

@ -12,7 +12,7 @@
<mat-option
*ngFor="let object of filteredPossibleObjects"
[value]="nameToShowInSelection(object)"
(click)="onOptionClicked($event, object, trigger)"
(onSelectionChange)="onOptionSelected(object, trigger)"
>
{{ nameToShowInSelection(object) }}
</mat-option>

@ -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() {

Loading…
Cancel
Save