json - res.render - passing parameters dynamically -


i'm trying figure out how render dynamically depending on number of parameters in object. let's create json example

var json = [     {            "param_1":11,         "param_2":22     },     {         "param_1":33,         "param_2":44     } ] 

and here how pass parameters if var json static:

res.render("template.hbs", { item_0_param_1: json[0].param_1 item_0_param_2: json[0].param_2, item_1_param_1: json[1].param_1 item_1_param_2: json[1].param_2 } 

the question have - how can pass parameters variable 'json' if not static? thinking doing loop inside render, didn't know how return assigned parameters. appreciate help. thanks!


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -