arrayOne: [
{
id: 1,
compId: 11,
active: false,
},
{
id: 2,
compId: 22,
active: false,
},
{
id: 3,
compId: 33,
active: false,
},
]
arrayTwo: [
{
id: 1,
compId: 11,
active: true,
},
{
id: 2,
compId: 33,
active: false,
},
]
I am presented with two JSON arrays and need to compare the compId keys in order to update the active key in arrayOne based on matching entries in arrayTwo.
In my attempt to solve this using AngularJs, I referred to a similar question on Stack Overflow which can be found here.
However, I now seek guidance on how to execute this comparison and update functionality in an Angular 6 project written in TypeScript.
The expected outcome should result in:
arrayOne: [
{
id: 1,
compId: 11,
active: true,
},
{
id: 2,
compId: 22,
active: false,
},
{
id: 3,
compId: 33,
active: false,
},
]