Possible Duplicate:
Custom for-loop helper for EmberJS/HandlebarsJS
I use Handlebars for a website and I have an important question :
Sometimes you give to your template a full array and you just want to show the n first element…
how do you do that with handlebars? I can’t find…
Here is how I did it (and it works !!!)
First,
i had in my model a ‘preview’ property/function, that just return the arrayController in an array :
Then, I add a new Handlebars helper :
And thanks to all this magic, I can then call it in my view :
And that’s it.
I know it is not optimal, so whoever have an idea on how to improve it, PLEASE, make me know 🙂