include not a function error
See original GitHub issueHi,
I am positive that the above error is caused by my implementation or use of ejs, but I have a scenario where I am trying to render a partial within a partial, this particular section of the view gets rendered after an Ajax call (I’m trying to split my views into smaller components)
I have a view file views/home.ejs
and within that I have <%- include('test-component') %>
The error I get is include is not a function
When sending the rendered html back to the client it is compiled through
const readAndCompileFile = async filePath => {
const file = await readFile(filePath);
return ejs.compile(file, { client: true });
};
const sendHtml = async (data, res) => {
const template = await readAndCompileFile(TEMPLATE_FILE_PATH);
const html = template({ ...data, Utilities, moment });
return res.send({ html });
};
I hope this is enough information but if anything further is needed then please advise
I am on the latest version of ejs, 3.1.3
Thank You
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Using .includes method in a function - javascript - Stack Overflow
includes () API is part of the String and Array data type. So what the error is trying to tell you is that...
Read more >TypeError: includes is not a function in JavaScript | bobbyhadz
The "includes is not a function" error occurs when the includes() method is called on a value that is not of type string...
Read more >How to solve includes is not a function in JavaScript - Reactgo
The “includes is not a function” error occurs when we call a includes() method on a value other than the strings or arrays....
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >".includes is not a function" for arrays of unquoted integers
See the above example. For the unquoted array, I get "TypeError: x.includes is not a function" in Firefox and Chrome. Why could it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you using “include” in .ejs file, don’t use client
Using EJS 3.1.3 with Express 4.17.1 and cannot get includes to work either
include not a function
without async.