问题
I have a json object "FoundAt" : [1, 3] How do I represent the values in the array using handlebar.js?
回答1:
If you are referring to iterating the array you can do so using {{each}} block, with reference to the above defined array use the following:
{{#each jsonObjectName.FoundAt}}
{{this}}
{{/each}}
OR
{{#each number in jsonObjectName.FoundAt}}
{{number}}
{{/each}}
Look for Simple Iterators in the official documentation
来源:https://stackoverflow.com/questions/13622660/how-to-represent-array-of-integers-in-handlebar-js