Created
July 14, 2012 18:36
-
-
Save abstractvector/3112573 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template: template.html | |
<div>{{> partials/nested-list.html}}</div> | |
Partial: partials/nested-list.html | |
<ul> | |
{{#list}} | |
<li> | |
<a href="{{url}}">{{title}}</a> | |
{{> partials/nested-list.html}} | |
</li> | |
{{/list}} | |
</ul> | |
node.js (with Hogan.js): | |
var list = [ | |
{ | |
title: 'Google', | |
url: 'http://www.google.com', | |
list: [ | |
{ | |
title: 'Google UK', | |
url: 'http://www.google.co.uk', | |
list: [] | |
}, | |
{ | |
title: 'Google US', | |
url: 'http://www.google.com', | |
list: [] | |
} | |
] | |
}, | |
{ | |
title: 'Yahoo', | |
url: 'http://www.yahoo.com', | |
list: [] | |
} | |
]; | |
res.render( | |
'template.html', | |
{ | |
locals: { list: list }, | |
partials: app.set('partials') // this is where they're stored, and they do work correctly | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment