Angularjs Quick Start

Source: Internet
Author: User

1.AngularJS bidirectional data binding (bi-directional)

<!DOCTYPE HTML><HTMLNg-app>    <Head>        <Scriptsrc= "Http://code.angularjs.org/angular-1.0.1.min.js"></Script>    </Head>    <Body>Your Name:<inputtype= "text"Ng-model= "Yourname"placeholder= "World">        <HR>Hello {{Yourname | | |    ' World '}}! </Body></HTML>
    • Text input directives <input ng-model="yourname" /> are bound to a named yourname model variable.
    • The double curly brace tag yourname adds the model variable to the greeting language book.
    • You do not need to register an event listener or add an event handler for the app!
    • Now try typing the name in the input box, and the name you type will be immediately updated to appear in the greeting. This is the concept of ANGULARJS bidirectional data binding. Any changes to the input box are immediately reflected in the model variable (One Direction), and any changes to the model variable are immediately reflected in the greeting text (the other side).

Analysis of 2.AngularJS applications

Describes the three components of the ANGULARJS application and explains how they map to the model-view-Controller design pattern:

Templates (Templates)

Templates are files written in HTML and CSS that show the view of your app. You can add new elements and attribute tags to HTML as instructions for the Angularjs compiler. The ANGULARJS compiler is fully extensible, which means that you can build your own HTML markup in HTML with ANGULARJS!

Application logic and Behavior (Behavior)

Application logic and behavior are controllers that are defined with JavaScript. Unlike standard AJAX applications, ANGULARJS does not require additional listeners or DOM controllers because they are built into the ANGULARJS.

Model data

Models are derived from the properties of Angularjs scope objects. The data in the model is probably a JavaScript object, an array, or a primitive type, which is not important, and it is important that they belong to the Angularjs scope object.

ANGULARJS maintains a bidirectional synchronization of the data model and the view interface UI through scopes. Once the model state changes, ANGULARJS is immediately refreshed and reflected in the view interface, and vice versa.

Angularjs Quick Start

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.