我想知道如何使用指令在AngularJS中按名称获取单选按钮的数量。
<label ng-repeat="elements in [1,2,3,4,5,6,7]">
<input type="radio" name="phone" ng-model="phone" value="example">
</label>
<!--Directive by name (phone), number of radio buttons is 7-->
<label ng-repeat="elements in [1,2,3,4,5,6,7,8,9]">
<input type="radio" name="OS" ng-model="OS" value="example">
</label>
<!--Directive by name (OS), number of radio buttons is 9-->
答案 0 :(得分:0)
可能在范围上分配一些值:$scope.myList = [1,2,3,4,5,6,7,8,9];
。并在视图上显示列表的长度,如:{{ myList.length }}
。