How to represent Array of integers in handlebar.js

会有一股神秘感。 提交于 2019-12-11 10:17:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!