Hi,
I want to bind boolean value to select element using KO, but obviously it doesn't work as expected.
html code:
<select data-bind="value: state">
<option value="true">On</option>
<option value="false">Off</option>
</select>
Javascript code:
var model = {
state: ko.observable(false)
};
ko.applyBindings(model)
So I expect the select box goes to "Off" position with the initial value false
but it was at "On". If I put state: ko.observable("false")
it will be correct but that's not I wanted. Anyone know how to bind the boolean value to select box with KO?
SO: http://stackoverflow.com/questions/10510683/knockoutjs-bind-boolean-value-to-select-box
Fiddle: http://jsfiddle.net/greenlaw110/Ajm58/
thx,
Green