I require some assistance. Essentially, there is a master list (arrList) and a selected list (selectedArr). I am comparing the 'id' and 'name' from the master list to those in the selected list, and then checking if they match to determine which checkboxes should be checked.
const formControls = this.arrList.map(
(control) => {
if(this.payload) {
let item = this.selectedArr.find(
(d) => d.id == control.id && d.name == control.name
);
return new FormControl((item !== undefined));
}
The master list consists of an array of objects with 'id' and 'name' fields:
{
"id": "23711086",
"name": "Test Propose Concept2 [P]"
}
However, the selected list (selectedArr) includes 'status(Inactive)' appended to the name along with 'id' and 'name', for example:
{
"id": "23711086",
"name": "Test Propose Concept2 [P] (Inactive)"
}
Even though the status is 'Inactive', if the name (partially) and id are the same, I want it to be checked. In other words, when
d.id == control.id && d.name == control.name
, it should return true
.