Access parent variable from nested block in JsRender -


how can access props's key nested for?

{{props object.items}}     {{:key}}     {{for prop.other_items}}         {{:key}} //here want print key props 

i've tried:

{{:key}} {{:#key}} {{:#parent.key}} {{:#parent.parent.key}} {{:~root.key}} 

here 3 alternative ways:

provide key contextual template variable, available in {{for}} block:

{{props object.items}}     {{:key}}     {{for prop.other_items ~outerkey=key}}         outer key: {{:~outerkey}}    {{/for}} {{/props}} 

provide data item of {{props}} block (the {key: ..., prop: ...} object) contextual template variable, available in {{for}} block:

{{props object.items itemvar="~outerprop"}}     {{:key}}     {{for prop.other_items}}         outer key: {{:~outerprop.key}}     {{/for}} {{/props}} 

step through parent views (array view, props item view) , data item (the {key: ..., prop: ...} object):

{{props object.items}}     {{:key}}     {{for prop.other_items}}         outer key: {{:#parent.parent.data.key}}     {{/for}} {{/props}} 

and here link related reply previous question matias: https://stackoverflow.com/a/31362057/1054484


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -