Open o1lab opened 7 years ago
How to handle tag <%- jsVariable %> where jsVariable is a string variable with several <%= %>
Usecase here:
<% for(var i = 0 ; i < largeObject.elementArray.length; ++i) {%> <%-largeObject.elementArray[i].myTemplate%> <%}%>
'.myTemplate' is a string variable - examples below:
largeObject.elementArray[i].myTemplate = '<%=largeObject.elementArray[i].variable_1 + largeObject.elementArray[i].variable_7 + largeObject.elementArray[i].variable_12%>'
or
largeObject.elementArray[i].myTemplate = '<%=largeObject.elementArray[i].variable_1 + largeObject.elementArray[i].variable_5 + largeObject.elementArray[i].variable_14%>'
'myTemplate' variable derivation is fairly complex and hence it is pre-calculated string - but then how do I expand 'myTemplate' string now.
My EJS knowledge is basic - I might be missing some technical correct terms explaining this problem.
This version of EJS is no longer maintained. The current one, available on NPM, is here: https://github.com/mde/ejs
Please ask this question over there, so other folks can follow the discussion. Thanks.
How to handle tag <%- jsVariable %> where jsVariable is a string variable with several <%= %>
Usecase here:
'.myTemplate' is a string variable - examples below:
largeObject.elementArray[i].myTemplate = '<%=largeObject.elementArray[i].variable_1 + largeObject.elementArray[i].variable_7 + largeObject.elementArray[i].variable_12%>'
or
largeObject.elementArray[i].myTemplate = '<%=largeObject.elementArray[i].variable_1 + largeObject.elementArray[i].variable_5 + largeObject.elementArray[i].variable_14%>'
'myTemplate' variable derivation is fairly complex and hence it is pre-calculated string - but then how do I expand 'myTemplate' string now.
My EJS knowledge is basic - I might be missing some technical correct terms explaining this problem.