0
votes

I have a precompiled template called "ReportOptions_Timeframe". When I call Handlebars.templates.ReportOptions_Timeframe(data) I do not get the rendered template html. Instead I get this for output:

"function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression, self=this;

function program1(depth0,data) { var buffer = ""; buffer += "\r\n " + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0)) + "\r\n "; return buffer; }

buffer += "Term:\r\n\r\n "; stack1 = helpers.each.call(depth0, (depth0 && depth0.TermList), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\r\n\r\n\r\n  \r\n\r\nDate range:\r\n\r\nto\r\n"; return buffer; }"

What am I doing wrong?

Edited to add the precompiled template:

(function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['ReportOptions_Timeframe'] = template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {};

return "function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", stack1, helper, functionType=\"function\", escapeExpression=this.escapeExpression, self=this;\n\nfunction program1(depth0,data) {\n \n var buffer = \"\";\n buffer += \"\r\n \"\n + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))\n + \"\r\n \";\n return buffer;\n }\n\n buffer += \"Term:\r\n\r\n \";\n stack1 = helpers.each.call(depth0, (depth0 && depth0.TermList), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});\n if(stack1 || stack1 === 0) { buffer += stack1; }\n buffer += \"\r\n\r\n\r\n  \r\n\r\nDate range:\r\n\r\nto\r\n\";\n return buffer;\n }"; }); })();

1
Please provide the code you are referring to. Do you have access to the template to show?Blunderfest
I have added the precompiled template as output by node.js.user3817118

1 Answers

0
votes

I was giving node the wrong input file. The input file I was using had been previously precompiled.