ANGULARJS Base-3 controller (basic Syntax), module (using Module registration Controller)

Source: Internet
Author: User

First, the basic grammar


Basic concepts

-Ng-controller

function Controllername ($scope, $http, $element) {}

$scope

$http

-$http. Get (URL). sucess (function (result) {})


Defining basic data types

-$scope. Name = "John"

-$scope. email = [email protected]

-$scope. Age = 30


Defining Object Properties

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7E/94/wKioL1cE3RHiTyWCAABR44Zj66k025.png "title=" Web.png "alt=" Wkiol1ce3rhitywcaabr44zj66k025.png "/>


Defining methods

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/97/wKiom1cE3KKwRxfJAAGGE793Dec876.png "title=" Web.png "alt=" Wkiom1ce3kkwrxfjaagge793dec876.png "/>


Second, the module


Registering a controller with a module


Basic concepts

-Injection: DI

-Centralized management through models

-Reduced coupling through model registration


Grammar

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7E/97/wKiom1cE3aSR3XbaAAF3Nb_cAXQ868.png "title=" Web.png "alt=" Wkiom1ce3asr3xbaaaf3nb_caxq868.png "/>


Module reference

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7E/94/wKioL1cE3qfQg-MBAAFjER8r39k220.png "title=" Web.png "alt=" Wkiol1ce3qfqg-mbaafjer8r39k220.png "/>


Summary: This chapter mainly introduces the AngularJS controller (basic syntax), modules (using the module registration Controller)


This article from the "Flying Ants" blog, declined to reprint!

ANGULARJS Base-3 controller (basic Syntax), module (using Module registration Controller)

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.