Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
dylan kane
2,772 PointsWhy can't I access JS functions made in separate JS files in my html when using Meteor
Meteor says when you write some javascript in a JS file, every file automatically has access to it everywhere in the app, but when I write a function in a a separate file like that, I just get a console error saying that function could not be found when I call it in html. The only way I can get it to work is by writing the JS in the html file but I want to keep the languages separate. Any idea on what the problem is?
dylan kane
2,772 Pointsthanks Talgat! why dont you put the comment as an answer so I can give you best answer!
1 Answer
Talgat Amanbayev
3,983 Pointsreposting my comment as dylan suggested: Hi! You need to implement the new 1.3 update feature - imports. Basically, just write somewhere on top of your JS file:
import '../folder/subfolder/filename.js';
works for me great. I hope it helps.
Talgat Amanbayev
3,983 PointsTalgat Amanbayev
3,983 PointsHi!
You need to implement the new 1.3 update feature - imports. Basically, just write somewhere on top of your JS file:
import '../folder/subfolder/filename.js';
works for me great.
I hope it helps.