Bootstrap (Initialize)
This chapter describes the angular initialization process and how to manually initialize the angular when necessary.
- Angular <script> Tags
- Don't say anything, let's start with an example. This example shows how angular recommends inheriting angular and automatically initializing angular.
<!DOCTYPE HTML><HTMLXmlns:ng= "http://angularjs.org"Ng-app> <Body> ... <Scriptsrc= "Angular.js"> </body></html>
1. We should place the script tag at the bottom of the page. This can improve the load time of your application. You can get the latest version from http://code.angularjs.org.
2. Ng-app indicates the root of your angular application. If you want your entire page to be a angular application, you can put it on the
3. If you choose to compare the old instruction syntax, for example: In order to be compatible with IE's lower version, you use the namespace in the HTML tag (this is a historical reason, we do not recommend that you use the namespace).
Automatic initialization
If the Angular.js script is referenced and document.readystate is the "complete" state, then Angularjs is automatically initialized in the Domcontentloaded event. At this point, angular will first look for the Ng-app directive as the root of your application. If angular discovers the Ng-app directive, it will:
1. Load the module associated with this instruction.
AngularJS--Bootstrap (starter)