$scope.isChecked = function(id){
var i=0,j=0,k=0;
//$scope.abc[i].usertype[j].keywords[0].key_bool=true;
if($scope.abc[i].type_selected == true){
while($scope.abc[i].usertype.length){
while($scope.abc[i].usertype[j].keywords.length){
if($scope.abc[i].usertype[j].keywords[k]._id == id){
if($scope.abc[i].usertype[j].keywords[k].key_bool == true){
$scope.abc[i].usertype[j].keywords[k].key_bool = false;
return false;
}
else{
$scope.abc[i].usertype[j].keywords[k].key_bool = true;
return true;
}
}
k++;
}
j++;
}
}
};
When incrementing k++, it is working as expected, but incrementing j++ is causing issues - can someone please explain why this is happening?
The isChecked function is called whenever a checkbox is checked or unchecked like this:
ng-click="isChecked(l._id)"
Everything functions properly for 'j=0', however, problems arise for subsequent 'j' values.