The radio selection options are generated by ng-repeat,
<label class="radio-inline" ng-repeat="list in fruits">
<input type="radio" name="sample" value="{{list.fruitName}}"> {{list.fruitName}}
</label>
// list对象格式
list = {
fruitName: '苹果',
id: 001
};
Now I want to 获取被选中的那个选项的id
. For example, if I choose Apple, Apple’s ID 001
will be returned at this time. How to achieve this?
I’m really waiting online. I’m so anxious. I’ve been working overtime for a week...Jianhu is asking for help. Thank you very much!
You can get it by using $scope.id in the controller
ng-model