标签:angularjs
#ng-disable 禁用标签 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <script src="js/angular.min.js"></script> </head> <body> <div ng-app="app" ng-controller="ctrl"> 同意:<input type="checkbox" ng-model="status" ng-init="status=0"/><br /> <input type="button" value="登陆" ng-disabled="!status"/> </ul> </div> <script type="text/javascript"> var m=angular.module(‘app‘,[]); m.controller(‘ctrl‘,[‘$scope‘,function($scope){ }]); </script> </body> </html>
#ng-repeat 标签,遍历对象 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <script src="js/angular.min.js"></script> </head> <body> <div ng-app="app" ng-controller="ctrl"> <ul> <li ng-repeat="d in odata"> my name is {{d.name}},i am {{d.age}} </li> </ul> </div> <script type="text/javascript"> var m=angular.module(‘app‘,[]); m.controller(‘ctrl‘,[‘$scope‘,function($scope){ $scope.odata=[ {‘name‘:‘cxiong‘,‘age‘:29}, {‘name‘:‘xmzhang‘,‘age‘:29} ] }]); </script> </body> </html> #ng-repeat 标签,遍历数组 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <script src="js/angular.min.js"></script> </head> <body> <div ng-app="app" ng-controller="ctrl"> <ul> <!--报错:数组中存在重复元素,track by $index--> <li ng-repeat="d in odata track by $index"> my name is {{d}} </li> </ul> </div> <script type="text/javascript"> var m=angular.module(‘app‘,[]); m.controller(‘ctrl‘,[‘$scope‘,function($scope){ $scope.odata=[‘xmzhang‘,‘cxiong‘,‘fjwu‘,‘cxiong‘] }]); </script> </body> </html>
angularjs-指令ng-disable,ng-repeat
标签:angularjs
原文地址:http://f1yinsky.blog.51cto.com/12568071/1955973