"Reprint" Angular.js Study notes (i)

Source: Internet
Author: User

-The most important concept in angular is instruction (directive)
-Ng-model is a bidirectional data binding directive, and the effect is to bind the Value property of the current element to [User.Name] in the model
# # # modules (module)
-We can create a module from Angular.module
-Angular.module method to pass two parameters is to create the module, one parameter is to get the module
# # # Controllers (Controller)

-Common method: <div ng-controller= "Hellocontroller" ></div>//ng-controller attribute is placed on the package label, control the code inside the package
In JS code:
-var module = angular.module (' HelloApp ', [])
-Module.controller (' Hellocontroller ', [' $scope ', ' $http ', function (A, b) {
Console.log (a);//The $cope object is printed
}]);
-by $scope and view associations
-$scope. $watch ('/* to monitor for changes in values */', function (now,old) {
Console.log (now);//The value entered
Console.log (old);//Input Previous value
})
-A NG plugin is recommended here: AngularJS Batarang, the NG Debug tool can be found under the Chrome console after installation
# # # expressions (expression)
{{}}
Angularjs expressions are much like JavaScript expressions, and they can contain an

literals, operators, and variables such as {{5 + 5}} or {{firstName + '-' + LastName}},

Number {{100 + 100}},

string {' Hello ' + ' angular '},

Object {{Zhangsan.name}},

Array {{STUDENTS[10]}}

Compare JavaScript Expressions:

The same point: the AngularJS expression can contain letters, operators, and variables.

Different points: AngularJS expressions can be written in HTML. AngularJS expressions do not support conditional judgments, loops, and exceptions. The AngularJS expression supports filters.

# # # Resolves a bug where ng appears first when loading a page
<style>
/* Ng-cloak instructions are automatically removed after Ng execution is completed.
[Ng-cloak],
. ng-cloak {
Display:none;
}
</style>
<body ng-app class= "Ng-cloak" ></body> or <body Ng-app ng-cloak></body>

This article transferred from: http://www.cnblogs.com/lm970585581/archive/2017/04/06/6672367.html

"Reprint" Angular.js Study notes (i)

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.