I need to pre-select a value from an drop-down option in a Aurelia repeat.for html template. I just cannot figure out how to pass the variable field into the get getValue(field) function. I want to pass it from the repeat.for="field of fields" data. Maybe this is not possible due to some binding behaviour or maybe I need to use some special syntax like e.g. value.bind="getValue($field)". I am thankful for any help or maybe a hint where I could search. I tried some aurelia docs and search machine searches without any success. Or a hint that the question is not asked properly.
view.html
<div repeat.for="field of fields">
<select class="form-control" value.bind="getValue(field)">
<option value="0">-</option>
<option repeat.for="connection of connections" model.bind="connection.field.value">...</option>
</select>
</div>
view.js
@computedFrom('fragmentedData')
get getValue(field) {
// if field is available in fragmentedData, return value, else 0 for empty option
}
getValueis it a string, number, or object? - Ashley Grant