对应关系
大--大象 中--猴子 小--蚂蚁
点击大象的时候 上面的单选框“大”选中,点击猴子 单选框“中”选中
点击蚂蚁单选框“小”选中
这样的单选框用ng怎么写啊?有没有大神,小白不太会。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="formCtrl">
<input type="radio" ng-model="size" value="0"/>大<br>
<input type="radio" ng-model="size" value="1"/>中<br>
<input type="radio" ng-model="size" value="2"/>小<br>
<input type="radio" ng-model="size" value="0"/>大象<br>
<input type="radio" ng-model="size" value="1"/>猴子<br>
<input type="radio" ng-model="size" value="2"/>蚂蚁
</div>
<script>
var app = angular.module('myApp', []);
app.controller('formCtrl', function($scope) {
$scope.size = 1;
});
</script>
</body>
</html>