-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
In the following example, $input3's value is bound to the selected option of $input2. Which of $input2's options is selected is bound to $input1. If we manually change the selected value of $input2, $input3's value updates as expected. If we change the value of $input1, $input2's value also updates as expected; however, $input3's does not. I suspect this is because updating $input1 does not directly change the value of $input2, but rather changes the selected attribute on its options.
R.div {}, [
$input1 = R.input {type: 'number', value: 0}
$input2 = R.select {}, [
R.option {value: 1, selected: bind -> parseInt($input1.rx('val').get()) > 0}, 'positive'
R.option {value: 0, selected: bind -> parseInt($input1.rx('val').get()) == 0}, 'zero'
R.option {value: -1, selected: bind -> parseInt($input1.rx('val').get()) < 0}, 'negative'
]
$input3 = R.input {type: 'number', value: bind -> $input2.rx('val').get()}
]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels