From 70fcec6ba2c846668d14948ece3054870fbd5f7f Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Fri, 15 Oct 2021 14:30:45 +0200 Subject: [PATCH] Change option elements value to (index) number Saving the actual drop down value did not work with duplicate option values. --- projects/common/element-components/dropdown.component.ts | 2 +- .../common/element-components/radio-button-group.component.ts | 3 +-- .../page-view/properties/element-properties.component.html | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/common/element-components/dropdown.component.ts b/projects/common/element-components/dropdown.component.ts index 2ecf91a14..4754e7768 100644 --- a/projects/common/element-components/dropdown.component.ts +++ b/projects/common/element-components/dropdown.component.ts @@ -20,7 +20,7 @@ import { DropdownElement } from '../classes/dropdownElement'; <mat-select (focusin)="onFocusin.emit()" [formControl]="elementFormControl"> <mat-option *ngIf="elementModel.allowUnset" value=""></mat-option> - <mat-option *ngFor="let option of elementModel.options" [value]="option"> + <mat-option *ngFor="let option of elementModel.options; let i = index" [value]="i"> {{option}} </mat-option> </mat-select> diff --git a/projects/common/element-components/radio-button-group.component.ts b/projects/common/element-components/radio-button-group.component.ts index a1575ccc5..b1bb42869 100644 --- a/projects/common/element-components/radio-button-group.component.ts +++ b/projects/common/element-components/radio-button-group.component.ts @@ -23,8 +23,7 @@ import { RadioButtonGroupElement } from '../classes/radioButtonGroupElement'; [style.margin-bottom.px]="25" [fxLayout]="elementModel.alignment" [formControl]="elementFormControl"> - <mat-radio-button *ngFor="let option of elementModel.options" - [value]="option"> + <mat-radio-button *ngFor="let option of elementModel.options; let i = index" [value]="i"> {{option}} </mat-radio-button> <mat-error *ngIf="elementFormControl.errors && elementFormControl.touched" diff --git a/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.html b/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.html index 5bfa5e3ad..ad721af34 100644 --- a/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.html +++ b/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.html @@ -127,7 +127,7 @@ <mat-select [value]="combinedProperties.value" (selectionChange)="updateModel('value', $event.value)"> <mat-option>undefiniert</mat-option> - <mat-option *ngFor="let option of $any(combinedProperties).options" [value]="option"> + <mat-option *ngFor="let option of $any(combinedProperties).options; let i = index" [value]="i"> {{option}} </mat-option> </mat-select> -- GitLab