-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More two-way binding #10
Comments
How would you handle radio buttons? Knockout has something like this: <label><input type="radio" value="Alpha" data-bind="checked: radioSelectedOptionValue" />Alpha</label>
<label><input type="radio" value="Beta" data-bind="checked: radioSelectedOptionValue" />Beta</label>
<label><input type="radio" value="Gamma" data-bind="checked: radioSelectedOptionValue" />Gamma</label> (source) |
I would suggest setting up click event handlers on each radio button. Then have a method to be used as an event callback, sending the input element to the event callback. Bellow is an example of this.
I know it might be confusing having a method called
EDIT: If all you wanted to do with the radio buttons is trigger a component event you can remove the select method all together.
|
That's not two-way binding, it's just MVC. |
@timdp You're right. There isn't any two-way bindings for radio button inputs. They're not supported at this time. |
Well, my question was more about how they will be supported, since that's what this issue is about. 😄 |
You could create your own radio input component. I've played around with an idea of a RadioGroup.html
App.js
|
How about binding and requiring a name for the checkboxes/radios? Then we can use the name to indicate which one is selected. |
use input events for two-way binding with textareas and non-checkbox/radio inputs
I'm opening individual issues for different two-way binding cases. Particularly keen to hear feedback on #311 as it pertains to the discussion above. Will close this issue in favour of the new ones. Thanks! |
Currently only a few
<input>
types are supported – need to handle textareas, selects, contenteditable, etc etc...The text was updated successfully, but these errors were encountered: