Known:
The ng-app instruction is used to tell the AngularJS application that this element is the root element.
All AngularJS applications must have a single root element.
only one ng-app instruction is allowed in the HTML document , and if there are multiple ng-app instructions, only the first one will be used, and the first Ng-app will be loaded automatically by one page.
Using Ng-app to declare angular boundaries, you can use the Ng-app directive to tell angular which piece of the page should be managed, either the entire HTML or a div
A ng-app can have multiple controllers
The scope of the $scope is limited to each controller
Here's the problem:
I just want more ng-app, although I do not know what is the use???
Here are some examples:
<!DOCTYPE HTML><HTML><Scriptsrc= "Http://apps.bdimg.com/libs/angular.js/1.3.9/angular.min.js"></Script><Body><DivID= "App1"Ng-app= "App1"><spanNg-controller= "Myctrl"Ng-init= "Firstname= ' John '; lastname= ' Doedoe '">{{firstName + "" + LastName}}</span><BR><spanNg-controller= "Yourctrl">{{secondname + "" + Thirdname}}</span></Div><BR><DivID= "App2"Ng-app= "App2"Ng-controller= "Yourctrl">{{secondname + "" + Thirdname}}</Div><Script>varapp=Angular.module ("App1", []); App.controller ("Myctrl", function($scope) {//$scope. LastName = "Doe";}); App.controller ("Yourctrl", function($scope) {$scope. Secondname= "Xiaomi 1"; $scope. Thirdname= "Rice 1";});varApp1=Angular.module ('App2', []); App1.controller ("Yourctrl", function($scope) {$scope. Secondname= "Xiaomi 4"; $scope. Thirdname= "Xiaomi 5";});//The default load is App1, which displays the startup app2 by the following code, but must be written after the APP2 declarationAngular.bootstrap (document.getElementById ("app2"), ['App2']);</Script></Body></HTML>
ANGULARJS Study Notes (1)--ng-app