Hi I am developing web application in Angular 5. I have one array and I want to update the same array based on the value of another array. For example, I have createarray as below.
I have another object as below.
data:{
checked:true,
name:infomodel
}
Now there is checked true in data. So for infomodel in createarray I want to update the checked property.
I tried as below.
let copyCreate = Object.assign({}, node.data);
copyCreate.checked = true;
const targetIdxCreate = this.createnode.map(item => item.name).indexOf(copyCreate.name);
this.createnode[targetIdxCreate] = copyCreate;
let copyUpdate = Object.assign({}, node.data);
copyUpdate.checked = false;
const targetIdxUpdate = this.updatenode.map(item => item.name).indexOf(copyUpdate.name);
this.updatenode[targetIdxUpdate] = copyUpdate;
In the above code, It updates createnode checked with true. Also I am making updatenode chcked to false. After executing the above code, both arrays will have checked property false.
can someone help me to do this?