The partial function has been removed from the latest version of Express, and using include can achieve the same effect, but the code looks uncomfortable, such as
1
|
<%-partial ("User/home", {User:users[0]})%>
|
Use the include notation as
1
|
<% var user=users[0]; Include user/home%>
|
But the ejs2.0+ version already supports this notation.
1
|
<%-include ("User/home", {User:users[0]})%>
|
Is it more comfortable than the partial ?
We need to install the latest version of the Ejs template enginenpm install ejs --save
If you are using a packaged template engine such as Koa-ejs, it may not support this syntax if it is internal or 1.0 old, you will need to find its dependent Ejs package in the node_modules folder and delete it so that you can use the Ejs version you installed.
The Include function for the latest version of EJS has supported parameter passing