1

In my .js file I have the following data structure

var menu = { "Sport":"Racing", "Region":{ "AUS":{ "name":"APrk", "key":"1234" }, "GB":{ "name":"Cran", "key":"5678" } } }; res.render('layout.jade', {locals: {menu: menu}}); 

In my layout.jade I have the following

for item in menu p= item 

This produces the following output

Racing

[object Object]

Which is on the right track. What I would like to know is how can I access the nested structures?

1 Answer 1

9

I believe you're looking for this

// layout.jade each value, key in locals.menu // may nest more iteration each v, k in value 

Iteration of object key/value does not grantee order. You may want to use array.

Details: https://github.com/visionmedia/jade#a9

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.