I can't seem to find a way of doing this, and have tried subexpressions and various other answers posted on StackOverflow - but they all seem to assume that I know the key I'm using in advance.
I have the following object:
{
fields: {
1: {
complete: 1,
submitted: 0
},
2: {
complete: 1,
submitted: 0
}
}
etc. etc.
In my Handlebars template, I'm looping through an array of objects. Each object in that array has a field_id key which is a number that matches up to the 1 or 2 in the above example.
I need to access the variables in the above array structure, based on the current field_id being looped. I've tried:
{{fields[(field_id)].complete}}
{{fields[{{field_id}}].complete}}
{{fields.(field_id).complete}}
{{fields.({{field_id}}).complete}}
And none of them work.
Is there a way of doing this?
field_idcome from?