Cannot access full context inside the loop
miki725 opened this issue · 1 comments
miki725 commented
I am trying to loop over an array and inside of the look, I am unable to access any of the other context variables.
context = {
array: [1, 2, 3, 4],
foo : 'hello world'
};
template = '{{array}}{{.}} {{foo}}<br>{{/array}}';
return Mark.up(template, context);
results in:
1 ???<br>2 ???<br>3 ???<br>4 ???<br>
adammark commented
The variable "foo" is outside the current context. You could set it as a global variable: https://github.com/adammark/Markup.js#global-variables