AngularJs的数据绑定
{{item.status}}是一种单项数据绑定。
{{item.status}}在controller中是使用$scope定义的。
可以使用ng-model进行双向数据绑定。这个时候,当界面中数据变化,controller中的这个数据同时变化就可以取到数值了。
如
1 <!doctype html> 2 <html ng-app> 3 <head> 4 <script src="http://code.angularjs.org/angular-1.0.1.min.js"></script> 5 </head> 6 <body> 7 Your name: <input type="text" ng-model="yourname" placeholder="World"> 8 <hr> 9 Hello {{yourname || 'World'}}! 10 </body> 11 </html>
1 $scope.yourname=[]; 2 console.log($scope.yourname);

浙公网安备 33010602011771号