Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent scope seems to be wrong #93

Closed
tailhook opened this issue Jul 26, 2016 · 4 comments
Closed

Parent scope seems to be wrong #93

tailhook opened this issue Jul 26, 2016 · 4 comments
Labels

Comments

@tailhook
Copy link
Contributor

The template is:

{{# each departments }}
    Department: {{ name }}
    Employees:
        {{# each employees }}
            {{ name }} ({{ ../salary }})
        {{/ each }}
{{/ each }}

And the json:

{
    "departments": [{
        "name": "developers",
        "salary": 100,
        "employees": [{
            "name": "Jonh Smith"
        }]
    }]
}

In http://tryhandlebarsjs.com/ I get the following output:

    Department: developers
    Employees:
            Jonh Smith (100)

But with this library I get the following output:


    Department: developers
    Employees:

            Jonh Smith ()

As far as I can observe it skips one scope. I.e. I can access ../departments from the internal {{#each employees}} loop (but I would expect it to be ../../departments). And I can't access the scope of the {{#each departments}} loop (so the ../salary is empty)

@sunng87 sunng87 added the bug label Jul 26, 2016
@bookshelfdave
Copy link
Contributor

@tailhook I had ta similar issue in #89.

@sunng87
Copy link
Owner

sunng87 commented Jul 26, 2016

This should be a different issue introduced in 0.19. I'm working on a fix.

sunng87 added a commit that referenced this issue Jul 26, 2016
Signed-off-by: Ning Sun <sunng@about.me>
@sunng87
Copy link
Owner

sunng87 commented Jul 26, 2016

This should be fixed in baf077b . I just added a test case for this.

@sunng87
Copy link
Owner

sunng87 commented Jul 27, 2016

Thank you @tailhook @metadave , I'm closing this and feel free to reopen if there's any question.

@sunng87 sunng87 closed this as completed Jul 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants