Search code examples
javascriptmustache

Showing fieldnames of mustache array


In the example below:

{{#content}}
        <tr>
        {{#show}}
        <td>{{ID}}</td><td>{{fieldname1}}</td><td>{{fieldname2}}</td>
        {{/show}}
        </tr>
{{/content}}

is it also possible to show the field/keynames themselves of the content array? Thus showing "fieldname1" and "fieldname2" instead of the values in these fields/keys.

Thanks


Solution

  • No, Mustache.js cannot do this. You'll need to write a helper using something like Handlebars as outlined in this similar question