I have JSON from helper
{
"Name": "abc",
"Age": 24,
"Address" {
"street" : "xyz street",
"city" : "zyz city",
"country" : "XY"
}
}
I want to print the address with key and values
<template name="User">
{{#with user}}
Name : {{Name}}
Age : {{Age}}
{{#each Address}}
{{key}} : {{value}} //Here is my question
{{/each}}
{{/with}}
</template>
How to print key and values in a template?
Changes to be made in JS
Changes to be made in HTML
The
{{#each}}
block helper only accepts cursors and arrays arguments.You could override the Address helper to make it return an array instead of an object.
You might want to define this utility function as a template helper :
JS
HTML