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

data property is being overwritten #280

Open
janthonyeconomist opened this issue May 18, 2017 · 0 comments
Open

data property is being overwritten #280

janthonyeconomist opened this issue May 18, 2017 · 0 comments

Comments

@janthonyeconomist
Copy link

I originally opened this in handlebars.js (see handlebars-lang/handlebars.js#1327 for more background). With more digging, we discovered the issue is due to the fact that in node_modules/consolidate/lib/consolidate.js you are passing "options" (which is the data for the template) into the engine.compile() method as well as the tmpl() method:

      var tmpl = cache(options) || cache(options, engine.compile(str, options));
      fn(null, tmpl(options));

The official way to use the plugin is something like:

var template = Handlebars.compile(tplStr, tplOpt);
document.getElementById('output').innerHTML = template(tplData);

where the data for the template is not also passed as the options for the compile method.

@nknapp https://github.com/nknapp said he would look into why compile is altering the options, and he thought you guys could look into why the template data is doubling for the options.

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

1 participant