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

handlebars.registerPartial can't work with html template element #1212

Closed
objectisundefined opened this issue Apr 21, 2016 · 3 comments
Closed

Comments

@objectisundefined
Copy link

objectisundefined commented Apr 21, 2016

{{> description}} expression in script tag, the code works,
but when I put it in template tag, it fails.
handlebars throw an error '{{&\g\t; ...' , '>' can't be compiled correctly.
Is there any method I can use with template element in html?

@ErisDS
Copy link
Collaborator

ErisDS commented Apr 21, 2016

Hi @objectisundefined! There's not enough info here for someone to understand or reproduce your issue to see what is happening. Please see the information here on reporting issues and put together an example showing what it is you're doing that's not working as you would expect.

@objectisundefined
Copy link
Author

objectisundefined commented Apr 22, 2016

I was starting to use Handlebars.registerPartial method, I put {{> son }} in a parent template.
If I use html5 template tag to contain the expression, the sign > in {{> was transformed to safe string.
If i use a script tag to contain the {{> expression of handlebars, the code works well.

@kpdecker
Copy link
Collaborator

This is a behavior of the browser attempting to "fix" what it deems to be invalid input. You need to use the script element to properly parse templates if you are choosing to embed them directly in html, but generally it's better to compile the scripts into you javascript bundles.

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

No branches or pull requests

3 participants