twigkit / tempo

Tempo is an easy, intuitive JavaScript rendering engine that enables you to craft data templates in pure HTML.
http://tempojs.com/
Apache License 2.0
709 stars 73 forks source link

Display only first item in array #74

Open difrnt opened 11 years ago

difrnt commented 11 years ago

Is there something built into tempo to allow you to display only the first item in a array? I have a json object that has multiple arrays inside of it. I want to display only the first item in each of the arrays. I can do this with some javascript intervention and {{_tempo.index}}, just was curious if there is another/better way.

mrolafsson commented 11 years ago

There isn't but it would be a very good idea...how about something like adding attributes data-first="0" data-last="10"?

difrnt commented 11 years ago

Sounds good to me. That or something like {{var[0]}} would work to if they wanted something more specific.

mrolafsson commented 10 years ago

Sorry for radio silence on this. Are you still using Tempo? Would you be interested in it's continued development?