Help Wanted: Plain Expressions inside expressions #1789
Unanswered
chetanjrao
asked this question in
Q&A
Replies: 1 comment
-
You can use the data itself inside a helper, like in this example. Or you can create two handlebars.js instances and pass the rendered result from the first instance to second instance (with the same data). This will render the syntax from helper. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I resolve a plain expression inside an expression?
Example: I have a helper that prepares a Handlebars expression like this
{{@../../key}}.{{@../key}}.{{@key}}
.When I use the expression
{{testHelper arg1 arg2}}
, instead of resolving key values, it returns the preapred expression as it is. How can I resolve an expression inside an expression.PS: Tried subexpressions, Asked on all other platforms, but no response
Simple Example here:
https://handlebarsjs.com/playground.html#format=1¤tExample=%7B%22template%22%3A%22%7B%7B%23each%20this%7D%7D%5Cn%5Ct%7B%7B%23each%20this%7D%7D%5Cn%20%20%20%20%5Ct%7B%7B%23each%20this%7D%7D%5Cn%20%20%20%20%20%20%20%20%5Ct%7B%7B%23each%20this%7D%7D%5Cn%20%20%20%20%20%20%20%20%20%20%20%5Ct%5Ct%7B%7B!--%20Expected%20Output%20(Just%20for%20illustration%2C%20cannot%20use%20this%20actual%20expression%20in%20logic)%20--%7D%7D%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Expected%20output%3A%20%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%5Ct%7B%7B%40..%2F..%2Fkey%7D%7D.%7B%7B%40..%2Fkey%7D%7D.%7B%7B%40key%7D%7D%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%7B!%20-------------%20%7D%7D%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Recieved%20Output%3A%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%7B!--%20Recieved%20output%20--%7D%7D%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%7Bhelper%20this%7D%7D%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%7B!%20-----------%20%7D%7D%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%7B%7B%2Feach%7D%7D%5Cn%20%20%20%20%20%20%20%20%7B%7B%2Feach%7D%7D%5Cn%20%20%20%20%7B%7B%2Feach%7D%7D%5Cn%7B%7B%2Feach%7D%7D%5Cn%22%2C%22partials%22%3A%5B%5D%2C%22input%22%3A%22%7B%20v1%3A%20%7B%20v2%3A%20%7B%20v3%3A%20%7B%20v4%3A%20%7B%7D%20%20%7D%20%7D%20%7D%20%7D%5Cn%22%2C%22output%22%3A%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Expected%20output%3A%20%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%5Ctv2.v3.v4%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Recieved%20Output%3A%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%7B%40..%2F..%2Fkey%7D%7D.%7B%7B%40..%2Fkey%7D%7D.%7B%7B%40key%7D%7D%5Cn%22%2C%22preparationScript%22%3A%22Handlebars.registerHelper('helper'%2C%20function(a)%20%7B%5Cn%20%20return%20%5C%22%7B%7B%40..%2F..%2Fkey%7D%7D.%7B%7B%40..%2Fkey%7D%7D.%7B%7B%40key%7D%7D%5C%22%5Cn%7D)%3B%5Cn%22%2C%22handlebarsVersion%22%3A%224.0.12%22%7D
expected output
v1 v2
recieved output
{{@key}} {{@key}}
Beta Was this translation helpful? Give feedback.
All reactions