<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
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>
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?
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
Use ng-checked
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?