I am using jQuery Tmpl and Knockout. I have templates:
Template 1:
{{each (index, model) Models}}
<div data-bind="template: 'template2', foreach: model.SubModels"></div>
{{/each}}
Template 2:
<div>${FieldFromSubModel} {__Here i need index from template 1__}</div>
How can I pass index variable to the second tempalate?
Please note, my templates are far more complex, so the structure should stay as it is.