-
Notifications
You must be signed in to change notification settings - Fork 2k
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
dynamic partials cause (lookupProperty(...) || (depth0 && lookupProperty(...)) || alias3).call is not a function #1727
Comments
Getting this same error when express-handlebars passes a template to compile to hbs, although I'm not using any partials at all. The code in the template looks like this: (lookupProperty(helpers,"json")||(depth0 && lookupProperty(depth0,"json"))||alias3).call(alias2,(depth0 != null ? lookupProperty(depth0,"googleMaps") : depth0),{"name":"json","hash":{},"data":data,"loc":{"start":{"line":102,"column":32},"end":{"line":102,"column":53}}}) |
Ah looks like the helper was defined in a .ts file, but |
So is there a resolution for this one? |
You can use the
|
I had this persisting for a long time , I figured out it was occurring because I passed a boolean variable into the "if" helper enclosed in a bracket [ {{#if ()}} ], apparently it is not supposed to be passed in that manner. It is supposed to be passed like this [ {{#if }} ] |
Before filing issues, please check the following points first:
Used versions:
handlesbars: 4.7.6
partials is saved in:
/views/partials/filename.handlesbars
varPartial = 'filename';
main template uses
{{> (varPartial)}}
outcome:
TypeError: (lookupProperty(...) || (depth0 && lookupProperty(...)) || alias3).call is not a function
at Object.eval [as main] (eval at createFunctionContext (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:262:23), :11:148)
at main (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
at ret (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
at ret (/usr/src/app/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
at ExpressHandlebars._renderTemplate (/usr/src/app/node_modules/express-handlebars/lib/express-handlebars.js:253:10)
at ExpressHandlebars.render (/usr/src/app/node_modules/express-handlebars/lib/express-handlebars.js:166:21)
at async ExpressHandlebars.renderView (/usr/src/app/node_modules/express-handlebars/lib/express-handlebars.js:224:15)
If I use
{{> 'filename'}}
It works
reproduced on fiddle:
Works with fix partial-name: https://jsfiddle.net/t9p508or/
Error with dynamic partial-name: https://jsfiddle.net/t9p508or/1/
The text was updated successfully, but these errors were encountered: