阿神2017-05-15 17:10:59
<label>
<input type="radio" ng-model="sex" value="male">
<span>男</span>
</label>
<label>
<input type="radio" ng-model="sex" value="female">
<span>女</span>
</label>
{{sex}}
As for the name attribute, I tried it. As long as the values bound to ng-model are the same, they are considered to be a group
ringa_lee2017-05-15 17:10:59
Use ng-checked
<label class="">
<input type="radio" ng-checked="option==1" ng-click="option=1">
<span>a</span>
</label>
<label class="">
<input type="radio" ng-checked="option==2" ng-click="option=2">
<span>b</span>
</label>
習慣沉默2017-05-15 17:10:59
The radio button box lacks the name attribute. How does the browser know that it is a group of radio button boxes? How does Angular know that it is a group of radio button boxes?