Print raw html strings on EJS

前端 未结 3 1175
悲哀的现实
悲哀的现实 2020-11-28 11:57

I\'m using express.js with EJS templates and i\'m trying to do something like this:

<%= \"Test\" %>

but

3条回答
  •  隐瞒了意图╮
    2020-11-28 12:32

    You should use html code everywhere, and use the EJS tags only where you need dynamic data. Example:

    <%= user.name %
    

    To specifically answer your question you can use <%- "" %> to output unescaped HTML data.

提交回复
热议问题