-
多选
<input type="checkbox" ng-model='game' ng-true-value="1" ng-false-value="0"/>游戏 <input type="checkbox" ng-model="video" ng-true-value="1" ng-false-value="0"/>电影
-
单选
<input type="radio" ng-model="sex" value="1" /> <input type="radio" ng-model="sex" value="0" />
-
下拉框
$scope.citys=$scope.data[0].city; 解决第一个选项为空白<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .ng-cloak{ display: none; } </style> </head> <body ng-app="app" ng-controller="ctr" ng-cloak class="ng-cloak"> <select ng-model="citys"> <option ng-repeat="item in data">{{item.city}}</option> </select> <p>{{citys}}</p> <script src="../angular.js"></script> <script> angular.module('app',[]) .controller('ctr',function($scope){ $scope.data=[ { city:'北京', code:541654 }, { city:'上海', code:5756 }, { city:'广州', code:54454 } ]; $scope.citys=$scope.data[0].city; }) </script> </body> </html>
转载于:https://www.cnblogs.com/aqigogogo/p/6745329.html