Angularjs Study (i)

Source: Internet
Author: User

1. HelloWorld article

1.1 Environment

Download: angular-1.2.5min.js

1.2 Source code

<!DOCTYPE HTML><HTMLNg-app>    <Head>        <script  src= "Angular-1.2.5.min.js"></script >     </Head>    <Body>Hello {{' World '}}! </Body><HTML

1.3 Running Results

  

2. Bidirectional data binding

2.1 Source Code

<!DOCTYPE HTML><HTMLNg-app>    <Head>        <Scriptsrc= "Angular-1.2.5.min.js"></Script>    </Head>    <Body>Your Name:<inputtype= "text" ng-model= "Yourname"  placeholder= "World" >        <HR>Hello {{yourname | | |    ' World '}}! </Body><HTML

2.2 Running Results

  

2.3. Description

Text input directive <input ng-model= "yourname"/> Binding a model variable called Yourname

Double curly braces mark the YOURNAME model variable added to the greeting language book.

You do not need to register an event listener or add an event handler for the change application!

Now try entering your name in the input box, and the name you type will be immediately updated to appear in the greeting, which is Angularjs's two-way binding concept. any changes to the input box immediately react to the model variable (One Direction), and any changes to the model variable are immediately reflected in the greeting text (another direction)

  

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.