dr11
dr11

Reputation: 5726

Correct way to include angularjs scripts on page

I have angularjs +bootstrap site with some directives, controllers, services, providers, etc.

What is the best guide for scripts including? In case when i include all scripts in a header this can affect on a page loading performance as scripts loading is blocking operation.

Is this correct to include angular.js and bootstrap.js in a header, and all controllers, directives, my custom scripts in a footer?

Upvotes: 0

Views: 47

Answers (2)

Ed B
Ed B

Reputation: 859

Your idea of referencing base javascript includes in the <head> is probably a good one, with the heavy-loading scripts coming just before the closing </body> tag.

After all, remember that best practice for AngularJS projects is no different to any other HTML page using Javascript.

In case you're looking for more detailed information, there are some interesting answers here and here on this topic.

Upvotes: 1

23tux
23tux

Reputation: 14736

Have a look at the yo angular generator here http://yeoman.io/ and here https://github.com/yeoman/generator-angular. This sets up a nice structure for your app

Upvotes: 1

Related Questions