javascript - MeteorJS - variable not defined -
i new meteor. created hello world project using meteor. project structure simple @ moment.
- root folder
- abc.css
- abc.html
- abc.js
in abc.js tried declaring variable this:
var lists = new meteor.collection("lists"); if (meteor.isclient) { template.hello.greeting = function () { return "my list."; }; template.hello.events({ 'click input' : function () { if (typeof console !== 'undefined') console.log("you pressed button"); } }); } if (meteor.isserver) { meteor.startup(function () { }); }
but when run this, getting following error in browser console:
[18:17:32.895] referenceerror: lists not defined
i not sure doing wrong.
in meteor variables scoped file. if define lists var
keyword can't access lists
outside abc.js
to passed remove var
just:
lists = new meteor.collection("lists");
then can access in other files console.
Comments
Post a Comment