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