1
votes

Is there a short hand way to loop over all the property keys, values and types in a model instance in ember js handlebars template.

For example wanting to do something like this in the template:

<ul>
  {{#each key, value, type in model}}
    <li> <span class="label label-info">{{key}}</span>: {{value}} is a {{type}} </li>
  {{/each}}
</ul>

Maybe this is just not possible with handlebars?

2

2 Answers

1
votes

Here's an example of something that might work for you:

https://gist.github.com/strathmeyer/1371586

2
votes

As far I know this is not possible as you already guessed. The only way I could think of would be to write your own each helper that supports this kind of loop. See here for a starting point on that.

Hope it helps.