N
N
not-deanon2017-07-24 17:01:54
Angular
not-deanon, 2017-07-24 17:01:54

How to mark the necessary checkboxes?

There are three checkboxes, for example:

<div ng-repeat="judge in judges">
 <input type="checkbox" name="eventJudge[]" ng-model="form.eventJudge.[judge.id]" value="{{judge.id}}">
</div>

These checkboxes transmit information to the server, for example, which people we have chosen. But how to do the opposite?
That is, an array comes from the server, which is passed to $scope.form.eventJudge. How to make sure that the necessary checkboxes are checked?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
ozknemoy, 2017-07-24
@ozknemoy

the structure of the array is not clear. if the indices of both arrays are the same, then
if not, then run through the iterator and throw in judges an additional flag eventJudge which is taken from the array and: it’s
just not clear why the checkbox values ​​are stored separately from the judge dictionary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question