passing function to ejs partial

1045 views node.js

I appologize if this is asked before but I couldn't find this question.

Basically i am trying to pass data into EJS partial the data has a function that I want to pass to partial but apparently it does not seems to work. Here is example.

    <title><%- title %></title>
    <%- include ('partials/header',{myFunction}) %> 
    <div id="content">
          <%- content %>
    <% include partials/footer %>

I have also tried using ES5 object literal syntax to pass function but it still throws me error that says

Error: Could not find the include file "(&#39;partials/header&#39;,{myFunction})"

I really appreciate if someone can pinpoint what am I doing wrong here.


answered question

1 Answer


I have figured out. It was a silly mistake. I had to remove whitespace where it says include ('partials/header',{myFunction})

posted this

Have an answer?


Please login first before posting an answer.