I need an array with selected checkbox values.
This is my html:
<form [formGroup]="form" class="charts">
<label formArrayName="charts" *ngFor="let chart of charts" id="form_charts">
<input type="checkbox" value={{chart.title}} (change)="selected_chart($event)">
{{chart.title}}
<span class="checkmark"></span>
</label>
</form>
And my function is:
selected_chart(e) {
if (e.target.checked) {
this.c_value = e.target.value;
this.charts_selected.push(this.c_value);
}
}
I have the array, but when we deselect the value still there; how to pop that value from the array? Any help will be appreciated