Use the JavaScript AngularJS library to compile the helloworld method _ AngularJS

Source: Internet
Author: User
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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.