Ionicradio默認的樣式,選取打勾在右側,不符合要求。javascript
checkbox樣式符合要求,選擇打勾在左側,修改成單選便可。html
<div class="list"> <ion-checkbox ng-repeat="item in devList" ng-model="item.checked" ng-checked="item.checked" ng-change="singleCheck(item)">//修改成單選的function {{ item.text }} </ion-checkbox> </div>
$scope.singleCheck = function(item){ var checkItem = item.text; $scope.devList = [ { text: "AAA", checked: false }, { text: "BBB", checked: false }, { text: "CCC", checked: false } ]; var devArr = $scope.devList; for(var i=0;i<devArr.length;i++){ if(devArr[i].text==checkItem){ devArr[i].checked=true; } } }