EJS - pass variable when include

前端 未结 3 1524
醉话见心
醉话见心 2021-02-19 18:33

I\'m using ejs in backend with nodejs. I\'d like to pass variable when include. When include the header, pass the page title.

index.ejs:

<% include he         


        
3条回答
  •  孤街浪徒
    2021-02-19 19:00

    As asked somewhere in the comments, we can also use a variable to be controled by a server, and here is how: <%- include("header",{my_tytle :`${myVar}`}) %>

提交回复
热议问题