i try use this example: http://codepen.io/thompsonemerson/pen/jPvgoy
my view:
<ion-view view-title="{{language}}"> <ion-content> <div class="text-center"> <div class="padding"> <h3 class="balanced">Alterar idioma</h3> </div> <ion-list> <ion-item class="item-checkbox" ng-repeat="item in itens"> <label class="checkbox"> <input type="checkbox" ng-model="item.checked" ng-click="updateSelection($index, itens, item.title)"> </label> {{ item.title }} </ion-item> </ion-list> </div> </ion-content> </ion-view>
my custom.js
(function(){
“use strict”;
angular.module(‘myApp’, [‘ionic’])
.controller('initCtrl', function($scope){
$scope.itens = [ { title: "Português (BRASIL)", checked: false }, { title: "Inglês (EUA)", checked: false }, ];
$scope.updateSelection = function(position, itens, title) { angular.forEach(itens, function(subscription, index) { if (position != index) subscription.checked = false; $scope.selected = title; } ); }
}); })();