Skip to content

Instantly share code, notes, and snippets.

@wycats
Forked from jescalan/loop.js
Created November 16, 2011 18:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save wycats/1370948 to your computer and use it in GitHub Desktop.
Save wycats/1370948 to your computer and use it in GitHub Desktop.
Handlebars No Name Loop
// The JSON
array = [
{
created_at: "2011-10-19T16:22:30Z",
id: 1,
link: "http://abcnews.go.com/Business/video/job-search-social-media-ditch-resume-hunt-nontraditional-ways-internet-professional-contacts-business-13581468",
title: "ABC News: Job Search Through Social Media",
updated_at: "2011-10-19T16:22:30Z"
},
{
created_at: "2011-10-19T16:22:30Z",
id: 2,
link: "http://www.adweek.com/news/advertising-branding/talent-takes-f-train-130622",
title: "Adweek: Talent Takes the F Train",
updated_at: "2011-10-19T16:22:30Z"
},
{
created_at: "2011-10-19T16:22:30Z",
id: 3,
link: "http://www.bloomberg.com/video/68220332",
title: "BloombergTV: Social Media: Connecting to Customers",
updated_at: "2011-10-19T16:22:30Z"
}
]
json = { objects: array }
// Handlebars code - I need to loop through the above items.
{{#each objects}}
<li><a href='{{link}}'>{{title}}</a></li>
{{/each}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment