JSON:(this.schedulerForm.get("schedularList").value => this array has contains below array.. )
const result = [{
formula_id:1,
quantity1:10,
quantity2:20,
quantity3:40
}]
conversion JSON:(Above JSON array contains 1 object with 3 quantity value. I need to seperate quantity value in each object with same formula_id along with month and year.. output should be like shown below.)
const result = [{
formula_id:1,
year:this.year,
month: this.month,
quantity:10
},
{
formula_id:1,
year:this.year,
month: this.month,
quantity:20
},
{
formula_id:1,
year:this.year,
month: this.month,
quantity:40
}]
component.ts:
month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];
year = new Date().getFullYear();
getDate(n){
const date = new Date();
return date.getMonth() + n;
}
save() {
console.log(this.schedulerForm.get("schedularList").value)
}