I have an array of checkboxes coming from a collection.
See below:
<div class="form-group">
Select days in a week :
<td class="even" *ngFor="let item of dayList">
<input value="{{item.check}}" type="checkbox" checked="item.check" formControlName = "selectedDays"> {{item}}
</div>
formControlName I am set as selectedDays.
I need to generate JSON object for the selected checkbox values.
Currently, i am getting boolean value in selectedDays. But I am supposed to get an array of checked values in an array inside JSON object.
this.dayList = ['Sun', 'Mon', 'Tue','Wed',"Thu","Fri","Sat"];
JSON Object looks like below, please note the value of selectedDays, it is supposed to be "Sun, Mon" based on selection, but it is showing as true.
Object
date
:
"2"
day
:
"Mon"
hour
:
"3"
minute
:
"3"
schedulerjobtype
:
"Daily"
selectedDays
:
true
useCase
:
"UC 2"
zone
:
"Zone 3"
How can I implement this?