In Angularjs learning, the use of a Angularjs program property for Ng-app initialization needs to be noted that ANGULARJS automatically loads the first Ng-app in one page, and the other Ng-app is ignored,
If you need to load other Ng-app programs, you need to add the initialization process manually.
Manually initialize other Ng-app JavaScript code angular.bootstrap (document.getElementById ("id"), [' ID ']);
<DivNg-app= "MYAPP"Ng-controller= "Myctrl"> <inputtype= "text"Ng-model= "First"/> <inputtype= "text"Ng-model= "Last"/> <BR/>Name: {first + "+ Last}}</Div><DivID= "UserForm"Ng-app= "UserForm"Ng-controller= "Usercontroller"> <inputtype= "text"Ng-model= "username"/><BR/> <inputtype= "text"Ng-model= "Password"/><BR/>User name: {{username}}<BR/>Password: {{password}}</Div>
<script type= "Text/javascript" > var app = Angular.module ("myApp", []); App.controller ("Myctrl",function($scope) { = "Test"; = "Test"; }); var userapp = Angular.module ("UserForm", []); Userapp.controller ("Usercontroller",function($scope) { = "Test"; = "Test"; }); Angular.bootstrap (document.getElementById ("UserForm"), [' UserForm ']); </script>
Configure one or more Ng-app
on the same page in Angularjs