Angularjs Getting Started learning notes one

Source: Internet
Author: User

First, declare:

This blog is derived from learning: Follow me to learn Angularjs:angularjs and the first example. Through learning, some of my own learning notes.

Some basic features of 1.AngularJS

(1) using double curly braces {{}} syntax for data binding;

(2) Using DOM control structure to iterate or hide dom fragments;

(3) Support the verification of forms and forms;

(4) The logic code can be associated to the relevant DOM elements;

(5) HTML can be composed of reusable components.

He is an MVC structure with two-way data binding features. is a schematic of two-way data binding:

Using the DOM as input, rather than as a string, is the biggest reason ANGULARJS differs from other frameworks. Using the DOM allows you to extend the instruction vocabulary and create your own commands, and even develop reusable components. ---This sentence I have not understood. After understanding, I'll explain.

The HTML template will be parsed into the DOM by the browser. The DOM then becomes the input of the Angularjs compiler. Angularjs will traverse the DOM template to generate some guidance, namely, Directive (directives). All instructions are responsible for setting data bindings for the view.

Mvc:

These are just some of the messy features. When I go deep into the study, it will be better to classify and write down the specific characteristics.

Getting Started instance one:

<p><input type="text" Ng-model = "Inputvalue"> Please enter content </ P>

<H1> What you have entered is: {{inputvalue}}</h1>

Angular is bound to a model called Inputvalue by Ng-model input input box.

The model is then bound to the H1 with two curly braces.

Getting Started example two:

The code is as follows:

<!DOCTYPE HTML>  <HTMLLang= "en" ng-app= "myApp" >  <Head>      <MetaCharSet= "UTF-8">      <title>Angularjs Getting Started</title>      <Scripttype= "Text/javascript"src= "./1.5.3/angular.min.js"></Script>  </Head>  <Body ng-controller  = "Mycontroller" >      <P><inputtype= "text"Ng-model= "Inputvalue">Please enter the content</P>      <H1>The content you entered is: {{inputvalue}}</H1>  </Body>  <Scripttype= "Text/javascript">  varapp=Angular.module ('myApp', []);//the HTML element that gets the entire Angularjs effect//ControllerApp.controller ('Mycontroller', function($scope) {$scope. Inputvalue= "Petertest";  }); </Script>  </HTML>  

Note that the above code is marked with a yellow section. These two respectively Angularjs the effective range of the controller layer.

First through the var app = Angular.module (' myApp ', []); Get the entire ANGULARJS affected app object.

And then get Mycontroller through App.controller,

Then let input data be associated with the scope ($scope) injected into our controller function.

The petertest is automatically populated as soon as the page is opened.

    
Angularjs Combat

From the study of Mu-class network http://www.imooc.com/video/2678 Angularjs Some of the practical notes.

Finally implement a bookstore application

Angularjs Getting Started learning notes one

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.