In Mustache templating is there an elegant way of expressing a comma separated list without the trailing comma?

I think a better way is to change the model dynamically. For example, if you are using JavaScript:

model['items'][ model['items'].length - 1 ].last = true;

and in your template, use inverted section:

    {{name}}{{^last}}, {{/last}}

to render that comma.

Leave a Comment