KO Options Binding

by bradleytrager

HTML

<select data-bind="options:options, optionsValue: 'value', optionsText: 'text', value: value">
    <select> <span data-bind="text: value"></span>

JavaScript

function ViewModel() {
    var self = this;
    self.options = ko.observableArray([{
        value: 1,
        text: "one"
    }, {
        value: 2,
        text: "two"
    }, {
        value: 3,
        text: "three"
    }]);
    self.value = ko.observable(
    
    );
}

var vm = new ViewModel();
ko.applyBindings(vm);