1. value是当radio被选中时赋给ngModel的值
<input type="radio" name="sex" value="1" ng-model="sex"/> 男 <input type="radio" name="sex" value="0" ng-model="sex"/> 女
2. 使用ngRepeat生成input[radio]项,注意:ngRepeat会生成新的scope作用域
<div ng-repeat="item in fee">
<input type="radio"
name="express"
ng-value="item"
ng-model="$parent.express"/>
<span>{{item.name}}¥{{item.price}}</span>
</div>
controller中的代码:
$scope.fee = [{
name: '圆通快递',
code: 'yto',
price: 10
}, {
name: '顺丰快递',
code: 'sfexpress',
price: 20
}];
// 默认值设置
$scope.express = $scope.fee[1];