【问题标题】:can i use 'this' operator in express-handlebars as array index in the same express-handlebars?我可以在 express-handlebars 中使用 'this' 运算符作为相同 express-handlebars 中的数组索引吗?
【发布时间】:2018-07-25 05:09:33
【问题描述】:
{{@root.comments.[this.[0]].[0]._id}}

错误:第 96 行的解析错误: ...t.cmets.[this.[0]].[0]._id}}:5:31) 在编(/home/nkhil/Nikhil/test-handlebar/node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12) 在 execIteration (/home/nkhil/Nikhil/test-handlebar/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19)


谁能帮帮我?

提前致谢

【问题讨论】:

  • 考虑添加有关错误来源的完整信息。
  • 能否提供完整的代码?

标签: express handlebars.js express-handlebars


【解决方案1】:

不,你不能那样做。这不是车把中的有效表达式。尝试保存状态而不是使用此运算符。

【讨论】:

    猜你喜欢
    • 2019-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-26
    • 2014-10-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多