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

support passing hash to partials #357

Closed
mattkime opened this issue Apr 7, 2015 · 6 comments
Closed

support passing hash to partials #357

mattkime opened this issue Apr 7, 2015 · 6 comments
Milestone

Comments

@mattkime
Copy link

mattkime commented Apr 7, 2015

see handlebars-lang/handlebars.js#182

support {{> partialName hashKey="foo"}}

(correct me if i'm wrong, but i attempted to use this feature and got an error so i assume its not supported. this is new in handlebars.js 2.0)

@jfbrennan
Copy link

Same problem here, but two things to note:

  1. if your NOT using Spring MVC, i.e. you're using Handlebars directly, then you need to do:
    new Handlebars( ).withJsFile("handlebars-2.0")

This is because Handlebars.java 2.0 actually defaults to using handlebars.js 1.3 (which seems crazy to me)

  1. if you are using Spring like me, then you're totally out of luck for now because the HandlebarsViewResolver just takes the default (1.3) and there's no way to override that. Totally lame and I came here to submit an issue for that.

From what I can tell, Handlebars.java 2.0 is for all intents and purposes still just Handlebars 1.3.

Someone please tell me I'm missing something...

@jfbrennan
Copy link

@jknack this is a duplicate of issue #350

@jknack
Copy link
Owner

jknack commented Apr 23, 2015

Guys,

I will try to find some time and do these changes. I've been busy working on my new project: jooby

But also, handlebarsjs 1.x has been around for years! and now in just a few month there is a 2.x and 3.x versions :S
I'm not saying that is wrong but it is hard to keep track of everything. So, I decided to collect new feature request/bugs from handlebars.java users and after that, do the necessarily changes.

The reason of keep using handlebars 1.3 in handlebars 2.0 was backward compatibility, but I think I will change this in next release.

@jfbrennan always forgot to update the Spring module :S but you are not lost. There is a workaround:

HandlebarsViewResolver viewResolver = new HandlebarsViewResolver() {
      @Override
      protected Handlebars createHandlebars(URLTemplateLoader templateLoader) {
        Handlebars hbs = super.createHandlebars(templateLoader);
        hbs.withJsFile("...");
        return hbs;
      }
    };

Thanks

@jfbrennan
Copy link

Ah, duh! Thanks man

@jfbrennan
Copy link

@mattkime nevermind, I think you already understand what I'm just learning which is that handlebarsJsFile is only used for the precompile helper/maven plugin.

@jknack jknack added this to the 2.1.0 milestone Apr 26, 2015
@jknack
Copy link
Owner

jknack commented Apr 26, 2015

duplicate of #350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants