Ng-checked does not show correct state with ion-toggle


I’m using the ion-toggle directive as follows:

<ion-toggle ng-repeat="item in settings" ng-checked="item.checked"
            ng-model="item.checked" ng-click="updateSettings(item)">
    {{ item.text }}

The controller code is as follows:

$scope.settings = [];

// getting saved settings from sqlite db
$ionicPlatform.ready(function () {
    Settings.all().then(function (settings) {
        $scope.settings = settings;
        $cordovaToast.showLongBottom("Settings retrieved : " + JSON.stringify(settings));

$scope.updateSettings = function (item) {
        //angular.forEach($scope.settings, function (setting) {
            $cordovaToast.showLongCenter("Updating with "+item.text+" , "+ item.checked);
            Settings.update(item.text, item.checked)
                .then(function (result) {
                    $cordovaToast.showLongBottom("Update successful : " + JSON.stringify(result));
                    $cordovaToast.showLongBottom("Update Error : " + JSON.stringify(err));

The directive doesn’t show the correct state when the app starts, despite the data being retrieved correctly from the database. It always shows checked. Could anyone point me to the mistake I’m making?

Thank you!

did you see this in StackOverflow? Looks like you are running into a similar issue

Thank you for pointing me to that thread. However, I had tried using only ng-model earlier. In that case it is always unchecked irrespective of the boolean value.