I have a simple json object:
“{"MediaType":1,"Country":2,"Region":3,"SubRegion":4}"
I want to bind it to a drop down so that the resulting html would look like the following. I don't know how to do this as the JSON represents different name and value or better put it is a representation of key value pairs.
<option value="1">Media Type</option>
<option value="2">Country</option>
<option value="3">Region</option>
<option value="4">Sub Region</option>
ko.applyBindings({
selectOptions: [
{ selectName: "MediaType", selectValue: 1 },
{ selectName: "Country", selectValue: 2 },
{ selectName: "Region", selectValue: 3 },
{ selectName: "SubRegion", selectValue: 4 }
]
});
<select data-bind="foreach: selectOptions">
<option data-bind="text: selectName, value: selectValue"></option>
</select>
--
You received this message because you are subscribed to the Google Groups "KnockoutJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knockoutjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.