问题
As I wrote in the title. In Ejs what's the difference between <%=, <% and <%-? for example I saw this code <% include ../partials/header.ejs %>, and then there is this code <%= title %>. I also saw <%- somewhere but cannot find a code example anywhere. So what's the difference? When do I use which?
I found this but it's for ruby on rails Difference between <% %> and <%= %> in RoR
回答1:
The following is from ejs docs (tag section):
- <% 'Scriptlet' tag, for control-flow, no output
- <%= Outputs the value into the template (HTML escaped)
- <%- Outputs the unescaped value into the template
See the difference between escaped and unescaped html here
来源:https://stackoverflow.com/questions/48522768/the-difference-between-and-in-ejs