ejs icon indicating copy to clipboard operation
ejs copied to clipboard

cannot include ejs file , include method give error

Open dipanshujain895 opened this issue 6 years ago • 0 comments

Well, I am trying to use the include(path) method of ejs in my project it doesn't work and the paranthesis of include are printed with the path in the error but when i changed it to include path it works,

now i want to use include(path, {variable: value}) this doesn't work and they are printing 'path , {variable: value}' as the path of file i am attaching screenshots of the code that's working and of the code that's not please help me!! i need help with giving the parameters in include method as ive given in screenshots

Screenshot from 2019-05-24 23-59-40 Screenshot from 2019-05-24 23-59-36 Screenshot from 2019-05-25 00-00-01 Screenshot from 2019-05-24 23-59-59 Screenshot from 2019-05-25 00-01-47 Screenshot from 2019-05-25 00-01-42 Screenshot from 2019-05-25 00-03-29 Screenshot from 2019-05-25 00-03-24

from the above images you can see if i add paranthesis to my include method the path doesn't get rendered and is printed the same what's written with the parantheis and double qoutes

but if i remove the paranthesis and double qoutes it's getting rendered correctly for the normal usage of include method i.e <%- include path %>

but the one with the parameter i am passing path is not getting rendered correctly i.e <%- include ../includes/add-to-cart , {product:product} %>

i tried <%- include("../includes/add-to-cart", {product: product}) %> from the official website's refrence and the github readme refrence but it's still not working as you can see in the screenshots

Please help me i am still learning node js so i don't know much!!!!

dipanshujain895 avatar May 24 '19 18:05 dipanshujain895