【发布时间】:2015-08-15 19:52:08
【问题描述】:
我正在使用带有嵌套 each 和 if 助手的把手模板。看起来是这样的
{{each resultSet}}
...some html...
{{each segment}}
{{if @index}}
---some html--
{{../someParentValue}}
{{/if}}
{{/each}}
{{/each}}
当我访问此someParentValue 时,我在控制台"Uncaught TypeError: Cannot read property '1' of undefined" 中收到此错误
如果我在路径中添加另一个级别,即 ../../someParentValue 以进入每个结果集的范围,则会收到错误 "Uncaught TypeError: Cannot read property '2' of undefined"
我不确定这可能有什么问题,因为在检查结果集时,我可以看到该结果集中的每个项目都有我要访问的属性。
【问题讨论】:
标签: javascript handlebars.js templating handlebarshelper