Browse Source

Fix bug with user selector.

pull/827/head
Sebastian 4 years ago
parent
commit
fefd23a63b
  1. 2
      frontend/src/app/features/settings/pages/languages/language-add-form.component.html
  2. 7
      frontend/src/app/framework/angular/forms/editors/autocomplete.component.ts

2
frontend/src/app/features/settings/pages/languages/language-add-form.component.html

@ -4,7 +4,7 @@
<form [formGroup]="addLanguageForm.form" (ngSubmit)="addLanguage()">
<div class="row gx-2">
<div class="col">
<sqx-autocomplete formControlName="language" displayProperty="iso2Code" [source]="addLanguagesSource">
<sqx-autocomplete formControlName="language" displayProperty="iso2Code" valueProperty="iso2Code" [source]="addLanguagesSource">
<ng-template let-language="$implicit">
{{language.iso2Code}} ({{language.englishName}})
</ng-template>

7
frontend/src/app/framework/angular/forms/editors/autocomplete.component.ts

@ -63,6 +63,9 @@ export class AutocompleteComponent extends StatefulControlComponent<State, Reado
@Input()
public displayProperty = '';
@Input()
public valueProperty = '';
@Input()
public placeholder = '';
@ -238,8 +241,8 @@ export class AutocompleteComponent extends StatefulControlComponent<State, Reado
let value = selection;
if (this.displayProperty) {
value = selection[this.displayProperty];
if (this.valueProperty) {
value = selection[this.valueProperty];
}
this.callChange(value);

Loading…
Cancel
Save