How to include html code in a view?

后端 未结 2 1069
醉梦人生
醉梦人生 2021-01-05 10:01

I\'m using express.js and EJS as template engine. I don\'t understand how to use partials, I have seen at the examples but the author used

2条回答
  •  既然无缘
    2021-01-05 10:39

    The correct code in your situation would be:

    <%- partial('part1') %>
    

    If you want to include unescaped HTML use <%- and if you want to escape HTML (unlinkely though when including a partial) you can use <%=.

    Resources:

    Node.js - EJS - including a partial
    http://groups.google.com/group/express-js/browse_thread/thread/62d02af36c83b1cf

提交回复
热议问题