<ion-checkbox ng-model="choice1"><b>I have extra points (+10)</ion-checkbox>
<ion-checkbox ng-model="choice2"><b>I do not have any extra points.</ion-checkbox>
Here’s my codes. I want to choose only one checkbox in my app. How can I do that? (I’m new)
It could be something like that, I hope it helps you.
HTML:
<ion-checkbox ng-repeat="item in listCheckbox"
ng-model="checkItems[item.text]" ng-change="itemShow(item.id,item.text)">
{{ item.text }}
</ion-checkbox>
JS:
$scope.listCheckbox = [
{id:1,text: 'I have extra points (+10)'},
{id:2,text: 'I do not have any extra points.'},
];
$scope.checkItems = { };
$scope.itemShow = function(item,text){
console.log(item);
console.log(text);
}
Use ng-repeat, to add several checkboxes and get your position of each one.
You only need to know when the checkbox is disabled