question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested "{{for}}" loop issue?

See original GitHub issue

Hi, I am trying to put together a template with jsRender instead of my own version that I was on, but, I keep getting a: “Uncaught JsRender Error: Syntax error Unmatched or missing tag: “{{/for}}” in template:” error followed by my entire template (maybe it should just be the template name instead, it gets pretty long).

Here is a truncated version of my code, any ideas as to what is going on? Or is it just the nested for loops?

<div class="page" id="{{:info.id+info.name}}">
    {{for sources}}
    <header class="feed-title">
        <div class="feed-title-content">
            <span class="feed-title-text">{{:title}}</span>
        </div>
    </header>
    <section class="row">
        <div class="scroll-left"></div>
        <div class="row-scroll">
            {{for articles}}

                          // An if, else and some standard content insertion stuff was here

            {{/for}}
        </div>
        <div class="scroll-right"></div>
    </section>
    {{/for}}
</div>

EDIT: Forgot to mention, I am loading this from an external file using John Papa’s code (http://msdn.microsoft.com/en-us/magazine/hh975379.aspx).

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AMKohncommented, Jul 20, 2012

Nevermind, I gave up and switched to Handlebars

0reactions
BorisMoorecommented, May 18, 2018

Did you mean like this?:

{{for list ~outerData=#data}}
...
{{if ~outerData.some.path===...}}
...

See http://www.jsviews.com/#parentdata

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my nested for loop not working as I expected?
The issue you're seeing is because of the nested for loop. You are essentially doing a cross-compare: for every item in i1, ...
Read more >
Topic 6 Nested for Loops - UT Computer Science
A for loop can have more than one loop nested in it. A for loop can have more than one loop nested in...
Read more >
Why are nested loops considered bad practice?
Nested loops increase cyclomatic complexity (see here), which decreases the maintainability of a program, according to some people. – Marco. May 29, 2013...
Read more >
4.4. Nested For Loops — AP CSAwesome
A nested loop has one loop inside of another. These are typically used for working with two dimensions such as printing stars in...
Read more >
Nested Loops cause performance issues - CAST Highlight
If the amount of data is large, nested loops are fully avoided due to performance issues. If the program is extracting small amount...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found