I want to bind boolean value to select element using KO v2.1.0, 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?
Jsfiddle: https://jsfiddle.net/greenlaw110/Ajm58/