[英]NodeJS Ejs Variable Render HTML
You can output variables using ejs like so 您可以使用类似的ejs输出变量
PagesController.test = function() {
this.title = 'test'
this.render();
}
<title><%= title %></title>
However I tried including html in the variable and it just displays it as text. 但是我尝试在变量中包含html,它只是将其显示为文本。 Is it possible to make it render as html? 是否可以将其渲染为html?
You need this construct: 你需要这个结构:
<%- title %>
That won't escape the contents of the title
variable. 这不会逃避title
变量的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.