javascript - Iterate through Array of Objects using Dustjs -
after jsonp phone call returned:
[ { "text": "yo whats up?", "id": 1 }, { "text": "hey man!", "id": 2 }, { "text": "dude.", "id": 3 } ]
heres actual api call: http://api.twitter.com/1/statuses/user_timeline/codinghorror.json
using dust.js like:
<ul> {#myposts} <li>{text}, {id}{~n}</li> {:else} <p>humm...</p> {/myposts} </ul>
but there no key "myposts" in response. that's problem. checkout api phone call see how json beingness returned, mabye i'm interpreting wrong.
what syntax utilize in dust.js iterate through each object in array?
you can utilize "current context" shortcut.
{#.} {text} - {id}<br /> {/.}
javascript json dust.js
No comments:
Post a Comment