Switch this:
this.choice = choices[1];
To this:
this.choice = ko.observable(choices[1].code);
Or even just this:
this.choice = ko.observable('F');
There were two problems:
- The
choice
was not an observable, that means a binding can't be formed between the underlying value and the selected option. - The initial value of
choice
was a whole object{ code: 'F', description: "Female" }
. But you specifiedcode
asoptionsValue
, sochoice
should have either value'F'
or'M'
.