samedi 28 février 2015

How to loop through an Json array in mustache template


Vote count:

0




I have an array with JSON object:



{result" : "OK","data":[
{"name" : "henrytest",
"id" : "9a3d1faaaac742889a940a6d9df49d16"},
{"name" : "henrytest",
"id" : "9a3d1faaaac742889a940a6d9df49d16"},
{"name" : "henrytest",
"id" : "9a3d1faaaac742889a940a6d9df49d16"}
]
}


I'm trying to loop through the array to get the 3 fields displayed in my table. However nothing is getting diplayed. Here is my mustache template:



<table style="width:100%;">
<thead>
<tr>
<th>Name</th>
<th>User ID</th>

</tr>
</thead>
<tbody>
{{#data}}
<tr>

<td>{{name}}</td>
<td>{{id}}</td>

</tr>
{{/data}}

</tbody>
</table>


I'm not able to display any fields in the table.Stuck badly with this..:( :(Any ideas how i can achieve this??



asked 43 secs ago







How to loop through an Json array in mustache template

Aucun commentaire:

Enregistrer un commentaire