0

I need to iterate each element except one.

<ul>
  {{#each [1,2,3,4,5] skip=3}}
    <li>{{@key}}</li>
  {{/each}}
</ul>
===> 
iterated keys [1,2,4,5]
4

1 回答 1

0

If you want to do all this inside handlebars. Then use an {{#if }} clause to filter out your element.

But I think the cleaner way is to inject clean data into your templates. So my take is that you should filter the array with JavaScript before passing it inside your template.

于 2013-10-22T15:49:29.860 回答