I am trying to create a tree from a list of tags that have tags inside.
Here is a JSON example that I use:
{ "tags": [{"name":"My first tag", "tags": [{"name":"My first tag inside a tag"}, {"name":"My second tag inside a tag"}] }] }
If I use the following mustache pattern, it detects βMy first tagβ without any problems:
<ul> {{#tags}} <li tag-id="{{id}}"> {{name}} </li> {{/tags}} </ul>
But then, using the following template, I try to display the tags inside this first tag:
<ul> {{#tags}} <li tag-id="{{id}}"> {{name}} <div> {{#tags}} <a>{{name}}</a> {{/tags}} </div> </li> {{/tags}} </ul>
Using this template, Mustache does not display anything.
How to display nested lists using Mustache?
source share