Received JSON from helper :
{
"perms": [
{
"userId": "rA5s5jSz7q9ZSCcNJ",
"perms": [
{
"moduleName": "Gallery",
"container": {
"ImageUpload": {
"addImage": false,
"modifyImage": false,
"removeImage": false
},
"Article": {
"readArticle": false,
"createArticle": false,
"modifyArticle": false,
"removeArticle": false,
"archiveArticle": false
}
}
}
]
},
{
"userId": "RrmynmmngJEMsRRpk",
"perms": [
{
"moduleName": "Gallery",
"container": {
"ImageUpload": {
"addImage": false,
"modifyImage": false,
"removeImage": false
},
"Article": {
"readArticle": false,
"createArticle": false,
"modifyArticle": false,
"removeArticle": false,
"archiveArticle": false
}
}
}
]
}
]
Included JS code :
'userWithRights':function() {
Meteor.call('genereObjectPermission',function(err, resp){
Session.set('responseServer', resp);
});
responseServer = Session.get('responseServer')
return _.map(responseServer, function(value, key) { return {key: key, value: value}; })
},'iterateInValue':function(){
return _.map(this, function(value, key) { return {key: key, value: value}; })
}
Here is the HTML representation of the data after multiple attempts:
{{#each userWithRights}}
<p> {{key}} </p>
{{#each value}}
<li>{{this.userId}}</li>
{{#each perms}}
<li><li>{{moduleName}}</li></li>
{{#each test58}}
<li><li><li>{{key}}</li></li></li
{{/each }}
{{/each}}
{{/each}}
{{/each}}
However, facing challenges when trying to iterate through nested objects using Handlebars:
{"container": { "ImageUpload": { "removeImage": false }}}
The desired output structure would be as follows:
- rA5s5jSz7q9ZSCcNJ
Gallery
ImageUpload
- addImage : true
- modifyImage : false
- removeImage : false
- Article
- readArticle: true
- createArticle: false
- modifyArticle: false