AngularJS (i)--starting from scratch AngularJS

Source: Internet
Author: User

Although it has been used for a very short time , but for AngularJS 's understanding is also very shallow, there is no systematic study, the following slowly, the system of carding once again AngularJS , incidentally learning points before almost no filterdirective service Wait a minute. Less nonsense, the first one is to see how to get started with AngularJS .

Simply put, in just two steps, you can use high-end atmospheric grade based on MVC 's AngularJS :

1.index.html :

<!doctypehtml>

2.index.js :

Statement Modulevar app =angular.module ("Learnmodule", []);//Declaration of the first Controllerapp.controller ("Firstcontroller", [///   Specifies the module "$scope" that needs to be injected, function ($scope) {$scope. person = {};  $scope. Person.name = "Lucy"; }]);//Declares a second Controllerapp.controller ("Secondcontroller", ["$scope", "$filter", Function ($scope, $filter) {$scope. Mo  Ney = $filter ("Currency") (12.5); }]);

Note the following three points:

1. module can be found in a module controller HTML ng-controller directives to specify which to use Controller

2. AngularJS Dependency injection feature, which explicitly declares which modules we depend on by [] [] function function ($ Scope, $filter)

3. $scope Object acts as a data model (M) in AngularJS,but unlike a traditional data model, $scope is not responsible for processing and manipulating data, it is simply a view ( v) and the HTML(v) between the bridge and the link.

Finish.


Resources:

"AngularJS authoritative course" Ari Lerner Translator: Shano Xu Fei He Pengfei

This article is from the "barrel of fake dog excrement" blog, please be sure to keep this source http://xitongjiagoushi.blog.51cto.com/9975742/1659247

AngularJS (i)--starting from scratch AngularJS

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.