Here is the input I am using:
<input type="checkbox" ng-model="area.id" data-id="{{area.id}}"/>
Above this, there is some action with ng-click
functionality. My goal is to gather all selected checkboxes' ids. However, after checking them, the value of the data-id
attribute changes to true/false
. Why does this happen?
The function in the controller looks like this:
collectSelectedAreas($event) {
let selectedArea = $event.currentTarget.querySelectorAll('input:checked');
let areaIds = [];
[selectedArea].forEach((el) => {
console.log(el.attributes['data-id'].value);
});
}