There are three ways to bind a angularjs parameter. The first interpolation expression "{{}}" indicates that the second is represented by using the Ng-bind property in the label, and the third is represented by the Ng-module property of the input box (label). The following three small cases are set for three parameter binding methods.
1. Interpolation expressions
Case Core Code:
Demo01.html:
<! DOCTYPE html>
ng-app= "MyApp">
<meta charset= "UTF-8" >
<TITLE>ANJULARJS Data Binding-interpolation expressions </title>
<body>
<div ng-controller= "Demo01controller">
<span>{{name}}</span>
<span>{{num1+num2}}</span>
<span>{{num1*num2}}</span>
<span>{{obg.address}}</span>
<span>{{address[0]}}</span>
<ul>
<li ng-repeat= "item in the address track by $index" >{{item}}</li>
</ul>
<ul>
<li ng-repeat= "item in university" >
{{Item.name}}
<ul>
<li ng-repeat= "ChildItem in Item.xueyuan" >{{childitem}}</li>
</ul>
</li>
</ul>
</div>
<script src= ". /js/angular.min.js "></script>
<script src= ". /js/app_module.js "></script>
<script src= ". /js/demo01controller.js "></script>
</body>
Case Effect:
2, Ng-bind
Case Core Code:
demo02.html:
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>ANJULARJS Data binding-ng-bind representation </title>
<body>
<div ng-controller= "Demo02controller" >
<span ng-bind= "name"></span>
<span ng-bind= "num1+num2"></span>
<span ng-bind= "num1*num2"></span>
<span ng-bind= "obg.address"></span>
<span ng-bind= "adress[0" ></span>
<ul>
<li ng-repeat= "item in the address track by $index" ng-bind= "Item" ></li>
</ul>
<ul>
<li ng-repeat= "item in university" >
{{item.name}}<!-- here with an interpolation expression, consider why? -
<ul>
<li ng-repeat= "ChildItem in Item.xueyuan" ng-bind= "ChildItem" ></li>
</ul>
</li>
</ul>
</div>
<script src= ". /js/angular.min.js "></script>
<script src= ". /js/app_module.js "></script>
<script src= ". /js/demo02controller.js "></script>
</body>
Case effect: (same as 1)
3, Ng-module
Case Core Code:
Demo03.html:
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>anjularjs Data binding-ng-module (for input box) </title>
<body>
<div ng-controller= "Demo03controller" >
<input type= "text" ng-model= "name">
<!-- Two-way binding --
<p>{{name}}</p><!-- or <p ng-bind= "name" ></p>-->
</div>
<script src= ". /js/angular.min.js "></script>
<script src= ". /js/app_module.js "></script>
<script src= ". /js/demo03controller.js "></script>
</body>
Case Effect:
Case all code download: Angularjs parameter binding. zip
AngularJS parameter Binding--angularjs