This article mainly introduces how to use the AngularJS library of JavaScript to compile helloworld. AngularJS is a popular JavaScript library, for more information, see the following example of the hello world code implemented by the AngularJS framework.
The following are some important aspects you need to pay attention to when looking at the Hello World example and the following code example.
- Ng-app, ng-controller, and ng-model commands
- Templates with two large arc types
Step 1:Partially contains Angular Javascript
Include the following codeTo introduce Angularjs javascript files. you can use the following code to get the latest code from the library managed by Google.
《script》
Step 2: apply the ng-app commandElement
Apply the ng-app commandElement. you can specify a name for the app. it can be simply written.. This command is used to mark Angular as an html element that identifies the root element of our application. this gives the app developer the freedom to tell Angular to treat the entire html page or just part of it as an Angular application.
Step 3: apply the ng-controller commandElement
Apply the ng-controller commandThe element. controller command can be applied to any element, such as p. In the following code, "HelloCtrl" is the name of the controller and can be placed inElement references the controller code in script and script.
Step 4: apply the ng-model command to the input element
You can use the ng-model command to bind the input to the same model.
Step 5: write template code
The following is the template code showing the model value of the model named "name". Note that the model named "name" is bound to the input in step 4.
Hello {{name}}! How are you doing today?
Step 6: