首页 > 代码库 > angularjs-指令ng-disable,ng-repeat
angularjs-指令ng-disable,ng-repeat
#ng-disable 禁用标签 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <script src="http://www.mamicode.com/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="http://www.mamicode.com/登陆" 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="http://www.mamicode.com/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=http://www.mamicode.com/["utf-8" /> <title></title> <script src="http://www.mamicode.com/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=http://www.mamicode.com/[‘xmzhang‘,‘cxiong‘,‘fjwu‘,‘cxiong‘]>
angularjs-指令ng-disable,ng-repeat
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。