I have the following:
const list = {
selected: null,
options: [
{name: 'option 1'},
{name: 'option 2'}
]
}
list.selected = list.options[1]
<select change.trigger="onChange(list.selected)" value.bind="list.selected">
<option repeat.for="entry of list.options" model.bind="entry">
${entry.name}
</option>
</select>
onChange(selected) {
console.log(selected)
}
When the onChange
event fires, it prints out the selected value. Problem is, that is prints out the previously selected value.
I need to add in
setTimeout( () => {
console.log(selected)
}, 100)
To make it print the correct selected value. Anyone else notice this?