Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle tag <%- jsVariable %> where jsVariable is a string variable with several <%= %> #225

Open
o1lab opened this issue Dec 7, 2016 · 1 comment

Comments

@o1lab
Copy link

o1lab commented Dec 7, 2016

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.

@mde
Copy link
Collaborator

mde commented Dec 8, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants