Home Problems in Markup.js accessing variable from the root when inside a loop

# Problems in Markup.js accessing variable from the root when inside a loop

Andrew Newby
1#
Andrew Newby Published in 2018-02-12 13:57:19Z
 I'm using Markup.JS ( https://github.com/adammark/Markup.js ), and it works well for the most of it. The problem I'm having, is accessing a variable from the parent loop. Here is the object that gets passed to it: The template code is: This works here: {{perms.link_modify}} {{links_loop}}
{{Title}} {{if URL}} {{URL}} {{else}} n/a {{/if}} {{if isValidated}} foo: {{perms.link_modify}} {{else}} {{/if}}
{{/links_loop}}  When run, this part:  foo: {{perms.link_modify}}  Comes up as ??? (non-recognised variable). The problem seems to be that it's not realising its meant to be coming from the root (not inside the loop itself). Is there a way to tell it to go up one level when looking? (hopefully that makes sense!) FWIW, I'm aware I can just copy the value of "perms" into the loop values, but this means repeating the same data over and over, and seems a bit of a messy hack (especially if there are 100's of items in the loop, as perms would need to be repeated in every one) UPDATE: I just found this post: https://github.com/adammark/Markup.js/pull/51/files?diff=split&short_path=04c6e90 I'm on version 1.5.21, so I'm trying to see how to implement it (as it's not released)
Andrew Newby
2#
Andrew Newby Reply to 2018-02-12 14:28:26Z
 OK, so while it seems this isn't possible with the current release (v1.5.21), it is possible with this hack: https://github.com/adammark/Markup.js/pull/51/files?diff=split&short_path=04c6e90 I've applied this fix, and it works well for me. I tried to post a PasteBin with the full code in, but it won't let me (as I've not posted any code directly, which would be too long-winded)
 You need to login account before you can post.
Processed in 0.327488 second(s) , Gzip On .