Within a spacebars template, there is a javascript array called x
and an index referred to as i
, for example:
Template.test.helpers({
'foo': function() {
return {
x: ['aa','bb','cc'],
i: 1
}
}
});
It is possible to access specific elements of the array x
in the template using {{ x.[1] }}
:
{{template name="test"}}
{{#with foo}}
{{x.[1]}}
{{/with}}
{{/template}}
However, the expression {{ x.[i] }}
does not yield the desired outcome.
Can someone suggest a way to properly access x[i]
? Thank you!