I have a JSON object which has a collection of values that it is used to evaluate and compare the values of checkboxes and check them. This works fine just when I open for the first time the modal box, but if I close the modal and open it again then the checkboxes are not selected anymore.
I am using angularjs and jquery.
app.controller('EnterpriseController', function($scope, $uibModalInstance, $location, EnterpriseService){
if($uibModalInstance && $scope.editableDepartment){
$uibModalInstance.rendered.then(function(){
for(var i = 0; i < $scope.editableDepartment.sections.length; i++){
$(".sections-list").find("input").each(function(){
if($(this).val() == $scope.editableDepartment.sections[i].id){
$(this).prop('checked', true);
}
});
}
});
}
});
Aucun commentaire:
Enregistrer un commentaire