最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Node EJS passing data to an include - Stack Overflow

programmeradmin4浏览0评论

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 badges
Add a ment  | 

1 Answer 1

Reset to default 8

Try:

<%- include('ponents/header.ejs', {data: 'data'}); %>
发布评论

评论列表(0)

  1. 暂无评论