AngularJS (1)

Source: Internet
Author: User

AngularJS (1)

Before you get to the point, talk about the angular profile:

1. AngularJS was born in 2009 and was created by Misko Hevery, who was later acquired by Google. is a good front-end JS framework, has been used in several Google products. Angularjs has many features, the most core of which are: MVC, modularization, automated bidirectional data binding, semantic tagging, dependency injection, and so on.
2. AngularJS is a JavaScript framework. It can be added to the HTML page by <script> tags.
3. AngularJS extends HTML through instructions and binds the data to HTML through an expression.

Now let's start with the first example:

<div ng-app= "" ng-init= "Name= ' Heng Bo '" > Your name is:{{name}}</div>

The Ng-app directive tells the angularjs,<div> element to be the "owner" of the AngularJS application.
The Ng-model directive binds the value of the input field to the application variable name.
The ng-bind directive binds the application variable name to the InnerHTML of a paragraph.

Next talk about Angularjs features:

1.AngularJS makes it easier to develop a modern single-page application.
2.AngularJS binds application data to HTML elements.
3.AngularJS can clone and repeat HTML elements.
4.AngularJS can hide and display HTML elements.
5.AngularJS can add code to the HTML element "behind".
6.AngularJS supports input validation.

Angularjs expression:

The 1.AngularJS expression is written in double curly braces: {{expression}}.
The 2.AngularJS expression binds the data to HTML,
3.AngularJS will "output" the data where the expression is written.
4.AngularJS expressions are much like JavaScript expressions: They can contain literals, operators, and variables.
such as {{5+5}}, {{uname+ ' and ' +yname}},{{r*3.1415926}}

Next, let's talk about some of the ANGULARJS instructions:

Directive One:

<div ng-app= "" ng-init= "Name= ' li po Chun pants ' > Your name is:{{name}}</div>

The AngularJS directive is an HTML attribute prefixed with NG.
The ng-init directive initializes the AngularJS application variable.
HTML5 allows extended data-to start with custom attributes. The AngularJS property starts with ng-,
You can also use data-ng-in the HTML5 page to make the page work for HTML5.

The Ng-app directive defines the root element of the AngularJS application.
The Ng-app instruction automatically boots (automatically initializes) the application when the page is loaded.
The NG-INIT directive defines the initial value for the AngularJS application.
Typically, ng-init are not used. A controller or module will be used to replace it.

Data binding for ANGULARJS:

<div ng-app= "" ng-init= "nn=1;price=5" > 

Synchronization via Ng-model instructions

Turn

AngularJS (1)

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.