我想要显示的默认单选按钮的选择价值为3我的代码如下: -选择默认值angularjs
<div class="checkbox-group" ng-init="ac.ServiceCode=3">
<input type="radio" ng-model="ac.ServiceCode" id="acuOne" value="1" ng-change='GetAcuityLevel(1)'>
<label for="acuityone">1</label>
<input type="radio" ng-model="ac.ServiceCode" id="acuTwo" value="2" ng-change='GetAcuityLevel(2)'>
<label for="acuitytwo">2</label>
<input type="radio" ng-model="ac.ServiceCode" id="acuThree" value="3" ng-change='GetAcuityLevel(3)'>
<label for="acuitythree">3</label>
<input type="radio" ng-model="ac.ServiceCode" id="acuFour" value="4" ng-change='GetAcuityLevel(4)'>
<label for="acuityfour">4</label>
<input type="radio" ng-model="ac.ServiceCode" id="acuFive" value="5" ng-change='GetAcuityLevel(5)'>
<label for="acuityfive">5</label>
</div>
但在这种情况下,它总是显示3,当我在上面删除代码它显示单选按钮中正确的选定值。我想如果服务返回一些值(1到5),那么应该选择单选按钮,否则应该选择默认值3。
显示您的服务。还有什么是你指出“当我删除上面的代码”?你上面说的代码的哪一部分? –
我在说ng-init =“ac.ServiceCode = 3” –