HTML:
<ion-content>
<ion-checkbox ng-repeat="item in listPref"
ng-model="checkItems[item.text]" ng-change="print()">
{{ item.text }}
</ion-checkbox>
<button type="button" name="button" ng-click="save()">Save</button>
</ion-content>
JS (internal controller):
$scope.listPref = [
{text: 'Cinema'},
{text: 'Sport'},
{text: 'It'} ,
{text: 'Music'},
{text: 'Theater'},
{text: 'Conference'}
];
$scope.checkItems = { }
$scope.print = function() {
console.log($scope.checkItems);
}
$scope.save = function() {
var array = [];
for(i in $scope.checkItems) {
console.log($scope.checkItems[i]);
if($scope.checkItems[i] == true) {
array.push(i);
}
}
console.log(array);
}
, , . print() , (true/false). save() . , , , , , , .
, .