dust.js - Is it possible to set the context to an outside variable inside a loop -
i content below json "discover xx76" , "visa xx73" etc.
{ "challengemap": { "card": { "verifier": [ { "value": "discover", "key": "0" }, { "value": "visa", "key": "1" } ], "additionalverifier": [ { "value": "xx76", "key": "0" }, { "value": "xx73", "key": "1" } ] } } } i able iterate through verifier array... there can't access "additionalverifier" array. there chances (or) need change json structure?
{#challengemap.card.verifier} {value} - {challengemap.card.additionalverifier[$idx].value} {/challengemap.card.verifier} any highly appreciated.
it's because context card.verifier , you're trying access parent level other context -> card.additionalverifier
you can : 1) change json structure. 2) try following:
{#challengemap.card.verifier card=challengemap.card} {value} - {additionalverifier[{@idx}].value} {/challengemap.card.verifier} or {#challengemap.card.verifier:challengemap.card} {value} - {additionalverifier{@idx}].value} {/challengemap.card.verifier} you can add helpers , print context @ stage..
{@contextdump key="current" to="console/}
then check browser console / node.js console...
Comments
Post a Comment