Currently I'm messing around with Node and EJS templates.
However I have hit a problem. Im building up a page made up of multiple ponents and im calling these ponents into the index page like so:
<% include ponents/header.ejs %>
My question is how can I pass data (json) to that specific include?
I want to be able to reuse ponents however to show different content ing from json.
Thanks
Currently I'm messing around with Node and EJS templates.
However I have hit a problem. Im building up a page made up of multiple ponents and im calling these ponents into the index page like so:
<% include ponents/header.ejs %>
My question is how can I pass data (json) to that specific include?
I want to be able to reuse ponents however to show different content ing from json.
Thanks
Share Improve this question asked Jan 5, 2016 at 22:01 themasterthemaster 3577 silver badges21 bronze badges1 Answer
Reset to default 8Try:
<%- include('ponents/header.ejs', {data: 'data'}); %>