The nodejs development was really cool. Really Thanks
How can I use parameters in partial? or what are the differences, if any?
The nodejs development was really cool. Really Thanks
How can I use parameters in partial? or what are the differences, if any?
No answer would also like to know
Do you mean data bindings?
I have a post with the same question but still no answer
Tried this ?
The EJS partial has access to all the same data as the parent view. But be careful: If you are referencing a variable in a partial, it needs to be defined in every view that uses the partialor it will throw an error.
You can also define and pass variables to an EJS partial in the include syntax like this:
views/pages/about.ejs
...
<header>
<%- include('../partials/header', {variant:'compact'}); %>
</header>
...
But you need to again be careful about assuming a variable has been defined.
If you want to reference a variable in a partial that may not always be defined, and give it a default value, you can do so like this:
views/partials/header.ejs
...
<em>Variant: <%= typeof variant != 'undefined' ? variant : 'default' %></em>
...
In the line above, the EJS code is rendering the value of variant
if it’s defined, and default
if not.
Full article HERE