You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have traced the error and it actually comes from the read = function ... function. Original code is like this in the functions body try ... catch block:
try{vardata=eval('(options.root.'+file+')');if(Object.prototype.toString.call(data)==='[object String]'){callback(undefined,data);}else{callback('Failed to load template');}}catch(e){callback(e);}
The problem is around eval function which actually does its job in global scope, where options is not defined, hence throwing the mentioned error. If you change the code like as follows, works like a charm :
try{vardata=options.root ? options.root[file] : null;if(data&&Object.prototype.toString.call(data)==='[object String]'){callback(undefined,data);}else{callback('Failed to load template');}}catch(e){callback(e);}
I have created online demos for non working one with original source:
Hi, thanks for the great job.
There is an issue with this engine, it throws
Reference Error: options is not defined
with the example you gave in documentation:I have traced the error and it actually comes from the
read = function ...
function. Original code is like this in the functions bodytry ... catch
block:The problem is around
eval
function which actually does its job in global scope, whereoptions
is not defined, hence throwing the mentioned error. If you change the code like as follows, works like a charm :I have created online demos for non working one with original source:
http://codepen.io/anon/pen/efACn
... working one, with the modification
http://codepen.io/anon/pen/CFhGp
hope this helps.
The text was updated successfully, but these errors were encountered: