Hi all,
I have created a dynamic select list that needs to show a list of options, the issue I am having is that I am showing the options using a description, that is visible to the user as well as values that are not visible to the user. Now I have got a default value that needs to be selected on loading the page, the problem is this value is a description and not a value type.
Is there any way to auto select this item using the description text and not the value text?
<ion-select [formControlName]="field.Identifier" interface="popover">
<ion-option *ngFor="let option of field.LookupDataSet" value="{{option.Value}}">{{option.Description}}</ion-option>
</ion-select>
and the backend:
var control = new FormControl(field.DefaultValue, this.validators);
this.inputForm.addControl(field.Identifier, control);
and the model:
export class Field {
Description: string;
DefaultValue: string;
LookupDataSet: LookupBarcode[]; //for select lists
Type: number;
Value: string;
Identifier: string;
setLookupDataSets(datasetArray) {
var datasets = new Array<LookupBarcode>();
for (let dataset of datasetArray) {
datasets.push(new LookupBarcode(dataset));
}
return datasets;
}
}
class LookupBarcode {
Value: string;
Description: string;
}