Skip to content

cannot include ejs file , include method give error #245

@dipanshujain895

Description

@dipanshujain895

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!!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions