2
votes

I have a tree like structure of comments I would like to render using handlebars in Ember CLI. Each comment can have an infinite set of replies, with each reply having an infinite amount of replies, much like you have on reddit. I have the following file 'comments.hbs'.

<div class="comments">
{{#each comments}}
    <div class="comment">
        <span><b>{{author}}</b></span> <span>{{showdown-addon text}}</span>
    </div>

    {{recursively-call-this-template-somehow-with-new-context replies}}
{{/each}}
</div>

Anyone have any idea how I can do this with Ember CLI? I've seen some solutions using {{> template-name}} but haven't managed to get it working.

1
I see that you rarely provide feedback to the answers in your questions. If an answer has been helpful you can up-vote it to say thanks and mark it as accepted if it solved your problem.givanse

1 Answers

2
votes

One approach would be to use an ArrayController that renders itself again if a list of replies is available.

Example: http://emberjs.jsbin.com/yamudi/1/edit?html,js,output