S
S
semki0962016-03-19 11:42:12
JavaScript
semki096, 2016-03-19 11:42:12

How can I display this in the handlebars template engine?

Here is my json

{"comment":[{"id":"1299","parent_id":"1305"},{"id":"1299","parent_id":"1305"}]}

I output it in a loop:
{{#each comments}}
         <p>{{id}}</p>
          <p>{{parent_id}}</p>
{{/each}}


And I need to display {{id}} from the first iteration, the option below does not work, I need to type {{ comments[1].id }}
<h1>{{id}}</h1>
{{#each comments}}
         <p>{{id}}</p>
          <p>{{parent_id}}</p>
{{/each}}
Это возможно посредством handlebars?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Wolf, 2016-03-19
@semki096

{{ comments/1/id }}, but in my opinion it is impossible to jump in the array in handlebas.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question