Save checkboxes marking

0

I need a solution in the code below: When checking one or more checkboxes I need to save the selected ones and also keep the ones that are already saved / marked; What is happening at the moment that when checking a checkbox, the ones that are already saved are unmarked and keeps only the newly marked ones, can anyone help me?

AngularJs

 <div class="row">
 <div class="form-group col-md-12">
 <label class="control-label">Modalidade:</label>
 <div ng-repeat="m in modalidades">
 <label>
 <input type="checkbox"
 data-checklist-model="evento.modalidades" 
 data-checklist-value="m"
 ng-model="evento.modalidade[m.idModalidade]" 
 ng-checked="getModalidadeChecked(m.idModalidade)" />
 <span>{{m.dsModalidade}}</span>
 </label>
 </div>
 </div>
 </div>

Javascript

$scope.getModalidadeChecked = function(idModalidade)
    {
        //console.log(idModalidade);

        var r = $.inArray(parseFloat(idModalidade), $scope.evento.modalidadeDatabase);

        if( r < -1 )
        {
            return true;
        } else {
            return false;
        }
    };

In the image below when selecting the "Triennial Evaluation" mode, the others below are overwritten, not saved. I hope you have understood my explanation !!

    
asked by anonymous 23.10.2018 / 16:39

0 answers