Within my form, there is a table with checkboxes in each column. The table consists of 3 <tr>
elements, and each <tr>
uses ng-repeate
to call the webservice and display clone data (in JSON format).
Upon clicking a checkbox, I create a JavaScript array to store the IDs using the following function :
checkoptions(array, model) {
angular.forEach(array, (value, key) => {
if (array[key].checked) {
model.push(array[key].id)
}
})
Regarding the HTML structure :
<tr ng-repeat="developer in $ctrl.developers">
<td>{{developer.label}}</td>
<td>
<input type="checkbox" id="{{developer.id}}"
ng-change="$ctrl.checkoptions($ctrl.developers,$ctrl.employees.developers)"
ng-model="developer.checked">
<label for="{{developer.id}}"></label>
</td>
The functionality works as intended, but the issue arises when unchecking a checkbox - it remains in the JavaScript array.