Luluzero's Angularjs Learning path _angularjs Sample code

Source: Internet
Author: User

Recently started self-taught angularjs this front-end MVC framework, feeling that MVC is cool to implement in front of the wood has. Hahaha ...

First of all, I have a basic understanding of the front-end MVC (the first learning contact is relatively simple, understanding may be some not in place, but also ask you to correct the great God).

First, the M (model) layer of MVC, the data Model layer, is used to process the data information in the business and the state information in the storage business. When the data in the model changes, the updated data needs to be displayed in the view layer. In the framework of the traditional back-end implementation of MVC, it is usually the page submits a form or the AJAX request to the background action, and the action calls the Business Processing module (service) to change the data in the background model layer, and finally return the data to the view layer and refresh the page. However, in Angularjs, we can implement model in the front-end, and through the Angularjs two-way data binding, so that the model layer of data in real-time display in the view layer, all this allows us to the front end of the processing of data directly to the backstage, You can even refresh the page without having to. All, this can reduce a lot of code, greatly improving the development efficiency of Web applications.

Here is an example of the first angularjs I wrote:

Hello.html

<!DOCTYPE HTML><HTMLNg-app= "Hello"><Head>    <title>Hello</title>    <Scripttype= "Text/javascript"src= "Javascripts/angular.min.js"></Script>    <Scripttype= "Text/javascript"src= "Javascripts/hello.js"></Script></Head><Body>    <DivNg-controller= "Yourname">        <label>{{You.title}}:</label>        <inputtype= "text"Ng-model= "You.name"placeholder= "Enter a Name Here">        <HR/>        <H1>Hello,{{you.name}}</H1>        <ButtonNg-click= "You.say ()">Say</Button>    </Div></Body></HTML>

Hello.js

var mymodule = angular.module ("Hello", []) Mymodule.controller ("YourName", [' $scope ',     function  ($scope) {        = {            title:' Input your name ',            name:'  ,            say:function() {                alert (this. name);}}        ;}    ]);

And I want to throw up the trough ... Angularjs's official website is on the mainland. WTF ...

Luluzero's Angularjs Learning path _angularjs Sample code

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.