-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Undefined data in one partial but not another #164
Comments
@dwilt Is one of the calls to Will you post the 2 handlebars snippets where you call |
Brian, filter.hbs (which is included in 6 pages - you can see it being called in the next file below)<div class="bd-filter">
<h3 class="bd-filter-heading">{{ heading }}</h3>
<ul class="bd-filter-list">
{{#each list }}
<li>
<a href="#">{{ @key }} <span class="bd-filter-count">{{ this }}</span></a>
</li>
{{/each}}
</ul>
{{>show-all-button }}
</div> a-z-development-all-articles.hbs---
name: "Development: All Articles"
---
<div class="bd-search-filter-container bd-container">
{{>search }}
{{>filter filters.a-z }}
</div>
<section class="bd-main-content bd-container">
{{>hero content.hero }}
<section class="bd-section">
{{>section-header content.all-articles }}
{{>article-list articles.a-z-development }}
{{>article-list articles.list-view }}
{{>show-all-button }}
</section>
</section> |
@dwilt Yeah... it looks like you're setting the data context to be at the This causes the context to be 2 levels lower than what you need for the buttons... You'd need to get the context back to the level of the buttons with something like... I'll comment again if I figure out any other solution. |
Is there a way to get the root context every time? On May 20, 2013, at 3:59 PM, Brian Woodward notifications@github.com wrote:
|
Someone put a pull request in on the handlebars project for adding the root context to the with and each helpers... handlebars PR I don't think there's a way with partials though. I thought that it used to work that way, that it would search up the context until it found what you requested, but that was either just in mustache or they changed it in handlebars. I'll look around some more and see what I can find, but most likely, it's a handlebars issue. |
yeah the syntax for moving up "levels" of context is |
I have 3 partials and 1 data file which are part of the problem.
buttons.json
button.hbs
show-all-button.hbs
leave-comment-form.hbs
Basically, what I have going on here is that I have 2 partials (show-all-button and leave-comment-form) which are including the button partial and passing in data from the buttons JSON file. When I try to grunt, I'm getting an error saying:
So, I removed both button partial calls from both files and I put some logging info at the top of
leave-comment-form.hbs
:And when I grunt, I get this:
So that's good. We know that the leave-comment-form.hbs partial is getting the buttons.json. But when I remove the logging from the top of
leave-comment-form.hbs
and put it intoshow-all-button.hbs
, I get this error:show-all-button
is getting called in two places from two different templates. Obviously buttons.json is available to the partial at one of the calls in the one file but not the other one. How could the data only be available to one partial call if it's global data?The text was updated successfully, but these errors were encountered: