I am using Knockout and jQuery tmpl. Binding to a data inside "field-string" template does not work.
<div data-bind="template: { name: 'userField', foreach: userFields }"></div>
<script type="text/html" id="userFilter">
<div data-bind="template: { name: 'field-string', data: { field: data, index: $index } }">
</div>
</script>
<script type="text/html" id="field-string">
<input type="hidden" value="fld.${$data.index}" />
<input type="text" data-bind="value: field.data" />
</script>
userFields - observableArray inside page viewModel, consists of such objects:
{
data: ko.observable("")
fieldName: "Blah-blah"
}
Please help. Thanks!
UPDATE: Here is the fiddle (don't know how to add more libs :(. I also need jquery.tmpl and jquery ) http://jsfiddle.net/WBvpp/