Skip to content

Instantly share code, notes, and snippets.

@jescalan
Forked from wycats/loop.js
Created November 16, 2011 19:16
Show Gist options
  • Save jescalan/1371029 to your computer and use it in GitHub Desktop.
Save jescalan/1371029 to your computer and use it in GitHub Desktop.
Handlebars No Name Loop
// The JSON (get back from api as javascript objects contained in an array)
// when logged to console, [▶Object,▶Object] etc.
// can be manipulated before being passed to handlebars
[
{
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"
},
{
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"
},
{
id: 3,
link: "http://www.bloomberg.com/video/68220332",
title: "BloombergTV: Social Media: Connecting to Customers",
updated_at: "2011-10-19T16:22:30Z"
}
]
// Handlebars code - I need to loop through the above items.
{{#each ???}}
<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