I have written a small plugin that displays tweets. following is the code that loops and displays the tweets.
<script id="tweets-template" type="text/x-handlebars-template" >
{{#each this}}
<li>
<p>{{tweet}}</p>
<span id="author">{{author}}<span/>
</li>
{{/each}}
</script>
But what I want to do is limit the number of tweets to 5 or 10. But the loop is listing all the available tweets. How do I limit the tweets like in for loop. like
for(i=0;i<5;i++){display the tweets}
I think you have two options:
The actual
eachimplementation is pretty simple so adapting it to include an upper limit is fairly straight forward:Then in your template: