I am facing an issue with a checkbox bound to an array of type Interface. The Interface looks like this:
export interface IdataTypes {
Categories: string,
isSelected: boolean,
}
This is how it is bound:
<div *ngFor="let DT of DTofSectores">
<input type="checkbox"
name="DTofSectors"
formControlName="DTofSectors"
value="{{DT.Categories}}"
(change)="onDataTypeClick($event,DT,'DTofSectors')" >
{{DT.Categories}}
</div>
The checkbox gets filled based on the selection from a dropdown list. My problem is that I want to clear all checked checkboxes when the dropdown changes.
EDIT: I have attempted to reset the bound array to null whenever the dropdown changes as shown below:
this.DSofSectores.push({
category :"",
isSelected : false
})
However, this leaves the array empty and no checkboxes are displayed!