JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.1.0.js"></script>
<!-- ko foreach: Parameters -->
<select data-bind="attr: { id: Name }">
<!-- ko foreach: ValidValues -->
<option data-bind="value: Value, text: Label, title: Label"></option>
<!-- /ko -->
</select>
<!-- /ko -->
JavaScript
var ViewModel = function () {
var self = this;
self.Parameters = ko.observableArray();
}
var currentItem;
$(document).ready(function () {
currentItem = new ViewModel();
ko.applyBindings(currentItem);
currentItem.Parameters([{
"Name": "WarehouseCode",
"ValidValues": [{
"Label": "Warehouse 1-- (01)",
"Value": "01"
}, {
"Label": "Warehouse 2 -- (02)",
"Value": "02"
}]
}]);
});