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

Is it possible to pass an object(or JSON) from express to a specific partial(for use by another contained js app)? #193

Closed
jiriToman opened this issue Aug 4, 2020 · 1 comment
Labels

Comments

@jiriToman
Copy link

jiriToman commented Aug 4, 2020

Hi, I am using express4.x with hbs as a view engine.
I am trying to register it via helper, but I am not getting any data. Should I be sending it somehow by the express?

This is my code for registering helper.

hbs.registerHelper('purchaseObject', function (context, Options) { return context.fn(jsonEnObject)});

I am just trying to get the data in the desired partial and it returns nothing.

<script>alert({{ jsonEnObject}})</script>

Thank you for any help or directions.

@dougwilson
Copy link
Contributor

Hi @jiriToman this module is just a wrapper for the handlebars.js project for Express.js . Your question is generically about handlbars, and one I don't know off-hand. I would ask over on the handlbars.js project (https://github.com/handlebars-lang/handlebars.js).

For reference as well, here is the documentation around registerHelper: https://handlebarsjs.com/guide/expressions.html#helpers

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

2 participants