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} 

dust tutorial examples.

you can add helpers , print context @ stage..

{@contextdump key="current" to="console/}

then check browser console / node.js console...


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -