默认值单选按钮进入ng repeat angularjs
作为标题,我需要选择第一个单选按钮作为ng repeat中的默认值默认值单选按钮进入ng repeat angularjs,angularjs,ionic-framework,ionic,hybrid-mobile-app,Angularjs,Ionic Framework,Ionic,Hybrid Mobile App,作为标题,我需要选择第一个单选按钮作为ng repeat中的默认值 <div class="customRadio" ng-repeat="item in fundSwitch.compatibleFund track by $index"> <ion-radio name="rifFondo" ng-model="dispositive.request.rifFondo" ng-value="item.codiceIsin" ng-checked="$first"
<div class="customRadio" ng-repeat="item in fundSwitch.compatibleFund track by $index">
<ion-radio name="rifFondo" ng-model="dispositive.request.rifFondo" ng-value="item.codiceIsin" ng-checked="$first">
<h3>{{item.descrizioneFondo}} {{$index}}</h3>
<p><strong>Data valorizzazione :</strong> {{item.dataQuotazione}}</p>
</ion-radio>
</div>
{{item.descripionefondo}{{$index}
数据增值税:{{item.dataQuotazione}
我在ng checked中尝试了其他条件:ng checked=“$index==0”,但它不起作用。我解决了它,并按照建议分配数组的第一个值:
$scope.fundSwitch.compatibleFund = FundService.extractFundSwitchParams(data)['fondiCompatibili'];
$scope.dispositive.request.rifFondo = $scope.fundSwitch.compatibleFund[0].codiceIsin;
谢谢你的帮助 我不认为ng checked和ng model应该一起使用。如何将item.codiceIsin的值初始化为数组中的第一个元素?我不能,因为item.codiceIsin的值是从服务器的响应中动态分配的。对不起,是指rifFondo的值-不确定这是否与您的答案有关。我需要在数组在视图中绑定之前迭代数组,还有其他方法吗?@stephen.vakil我分配了数组的第一个值,它对我有效;)谢谢