我试图使用EJS动态地包含我的部分内容.我渲染一个这样的模板:
路由器
router.get('/', noteController.getNotes, (req, res, next) => {
return res.render(template, {'page':'all'})
})
Run Code Online (Sandbox Code Playgroud)
并且我试图在此模板中包含部分变量,基于变量"page".
template.ejs
<% include %><%= page %><% .ejs %>
Run Code Online (Sandbox Code Playgroud)
然而,这不起作用.我尝试过多种方法,但无济于事.任何帮助深表感谢.