ANGULARJS-expression
The ANGULARJS expression is written in double curly braces:{{expression}}
Angularjs expression binds data to HTML, which is similar to the Ng-bind directive
Angularjs will "output" data where the expression is written
Angularjs is much like a JavaScript expression: He can contain literals, operators, and variables
Instance:
<! DOCTYPE html> <html> <head> < Span class= "hl-brackets" > <meta charset= "utf-8 "> < Span class= "Hl-code" > <script src= " Http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js> < Span class= "hl-quotes" > < Span class= "Hl-code" > </script > < Span class= "Hl-code" > </head> < Span class= "Hl-code" > <body < div ng-app= "" > <p> my first expression:
</p> </div> < Span class= "hl-brackets" > </body> </html> Output: My first expression: 10AngularJS application Angularjs Module (
Moudule) for ANJULARJS applications
Ng-appDirectives define the application,
Ng-controllerDefines the controller. Angularjs instances:
<! DOCTYPE html>
<meta charset= "Utf-8" >
<script src= "Http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js" ></script>
<body>
<p> try to modify the following form. </p>
<div ng-app= "myApp" ng-Controller= "Myctrl" >
Name: <input type= "text" ng-model= "FirstName" ><br>
Surname: <input type= "text" ng-model= "LastName" ><br>
<br>
Name: {{firstName + "" + LastName}}
</div>
<script>
var app = angular.module('myApp', []);
App.controller (' Myctrl ', function ($scope) {
$scope. Firstname= "John";
$scope. Lastname= "Doe";
});
</script>
</body>
ANGULARJS module definition application:
ANJULARJS Module
var app = angular.module (' myApp ', []);
ANGULARJS controller Control applications:
ANJULARJS Controller:
App.controller (' Myctrl ', function ($scope) {
$scope. FirstName = "John";
$scope. LastName = "Doe";
})
Angularjs Study Chapter II (ANGULARJS expression)