JsRender. Nested loop by the object of top loop

冷暖自知 提交于 2019-11-29 15:39:20

There are several ways of getting to parent views. See http://www.jsviews.com/#views: get(type) method, Accessing "parent" data, from nested views, etc.

For example you can create a contextual template parameter: ~index

{{for players}}
   <tr>
    {{for ~root.players ~index=#index}}
        {{if ~index == #index}}
            <td>*</td>
        {{else}}
            <td>{{:~index}}+{{:#getIndex()}}</td>
        {{/if}}
    {{/for}}
   </tr>
{{/for}}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!