You can use the Mustache function. They are defined in your template, as in any other section, and then run on the content that they wrap. For your case, it would look something like this:
{ "items": [ {"display": "Item 1"}, {"display": "Item 2"}, {"display": "Item 3"}, {"display": "Item 4"} ], "trim": function () { return function (text, render) { return render(text).replace(/(,\s*$)/g, '');
Then your Usa markup will look like this:
{{
And your result will be what you will be:
Item 1, Item 2, Item 3, Item 4
Check it out on jsfiddle .
source share