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

Currently I'm messing around with Node and EJS templates.However I have hit a problem. Im building

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'}); %>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744198289a4562758.html

相关推荐

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

    Currently I'm messing around with Node and EJS templates.However I have hit a problem. Im building

    8天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信