Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Tzili Hod
5,836 PointsWhy is angular included in body tag?
Why is Angular included in the body tag as opposed to the head tag? Same for app.js.
3 Answers

Ryan Huber
13,021 PointsIt is best practice to put your script loads right before the closing body tag of your html. You should let you html structure load before trying to load in any JS files which could be long and take time to load. That way your user won't be stuck looking at a blank page while you JS files are loading. Here is a more in depth explanation https://teamtreehouse.com/community/best-practice-where-to-include-your-script-tags Let me know if you have any other questions.

Tzili Hod
5,836 PointsThank you! That makes sense.

Kevin McNamara
7,483 PointsRelated question: what does the vendor/angular.js script even do? I don't quite understand where that code is coming from, or what its purpose is. Thanks!

Farid Wilhelm Zimmermann
16,741 PointsThe vendor/angular.js is the file, which basically holds the "angular framework".
We have many different ways of including frameworks and libraries in our code, we can either use a CDN(Content Delivery Network, think about Bootstrap or jQuery etc.), but we can also just download the framework file and include it in our code manually (like if we'd run our own webserver, that way we would have more control over the version we use, would help us customizing etc.).
We have to link it before our app.js file, so that we can access angular functions/methods inside our app.js file.
Mister Moody
41,727 PointsMister Moody
41,727 PointsWith standard JavaScript, I would def follow your advice. Just not so sure about this question as I am certain that the instructor intentionally placed the JS Script in the <head> Tag, for whatever(?) purpose.