Search code examples
jsrender

jsRender loop a List<string>


A question on the {{for}} loop in jsRender.

The demo shows we can loop through a collection of complex objects and display their properties:

{{for languages}}
    <div>
        <em>{{>name}}</em>
    </div>
{{/for}}

But what if my languages is only a List<string>? There will be no {{>name}} to be displayed. How can we reference the individual string values?

Thanks.


Solution

  • You should be able to use #data to access the individual string values inside the loop.