Hi,
I put simple check in function on check in my check box list:
$scope.pushNotificationChange = function(item) {
var limit = 3;
var length = Settings.getSize();
var checkedcount=0
for (var i=0; i<length; i++)
checkedcount+=( Settings.get(i).checked)? 1 : 0
if (checkedcount>=limit){
alert("You can only select a maximum of "+limit+" checkboxes")
Settings.get(item.id-1).checked = false;
}
Settings.save();
};
Functions in services looks like
save: function() {
window.localStorage[āinteresā] = JSON.stringify(_settings);
$rootScope.$broadcast(āinteres.changedā, _settings);
},
// Get a settings val
get: function(k) {
return _settings[k];
},
// Set a settings val
set: function(k, v) {
_settings[k] = v;
this.save();
},
The problem is that line Settings.get(item.id-1).checked = false; want uncheck the item but if I put Settings.get(item.id).checked = false; it will uncheck the next item that is after the checked oneā¦
Is there some prohibition that state of check canāt be changed on item where check is currently done ?