Im trying to iterate an Array of Objects for putting their values in a Handlebars template using the each loop inside the structure of the array. Here you can see the array:
var datosSensores = [
{
name:'John Pinard',
email:'[email protected]',
ph: [
'7.80',
'7.90',
'7.60',
fecha: [
'2016-06-20 09:00',
'2016-06-21 10:00'
],
],
}
];
And the each loop if've tried as you can see:
{{#each ph}}
....
.....
{{#each ph.fechaPH}}
{{this.fechaPH}} //This would be the value of each DATE in the array
{{/each}}
{{/each}}
I dont know how to solve it or what I'm doing wrong. I appreciate any comment about this issue Thanks a lot!
You're almost using the correct syntax :
{{#each ph}}
....
.....
{{#each fecha}}
{{this}} //This would be the value of each DATE in the array
{{/each}}
{{/each}}
When you're inside a #each loop the this object becomes the "root" node so you don't need to name ph.fecha but just fecha as ph is the root.
[Edit] : I've changed the name fechaPH does not exist in your example it is fecha.
{#each main}}
{{#each sub}}
<p>{{ ../dataOfMain }}</p>
<p>{{ subData }}</p>
{{/each}}
{{/each}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With