can i use 'this' operator in express-handlebars as array index in the same express-handlebars?

时间:2018-07-25 05:09:33

标签: express handlebars.js express-handlebars

{{@root.comments.[this.[0]].[0]._id}}

Error: Parse error on line 96: ...t.comments.[this.[0]].[0]._id}}:5:31) at prog (/home/nkhil/Nikhil/test-handlebar/node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12) at execIteration (/home/nkhil/Nikhil/test-handlebar/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19)


can anybody please help me ?

Thanks in advance

1 个答案:

答案 0 :(得分:2)

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