I have a div with several items that can be chosen and have their fields edited, the edition is working but the edition is changing all the fields and all the items too.
This is the html of when I select one of the items
<div cdkDropList id="{{ordem.id}}" [cdkDropListData]="ordem.secoes" [cdkDropListConnectedTo]="idsOrdens" class="example-list" (cdkDropListDropped)="drop($event,ordem)">
<div class="col-12 border rounded-3 bg-claro-color col-12 p-3 mb-3 d-flex justify-content-between" *ngFor="let item of ordem.secoes" cdkDrag>
{{item.nomeSecaoPT}}
<button (click)="EDIT(item)" type="button" class="btn btn-primary-color rounded-pill d-flex align-items-center px-5 py-2 h7 fw-500" >
Edit Question
</button>
</div>
</div>
And this is the function that html calls
EDIT(item: any): void{
console.log(item)
let modalEditarSecao = this.modalService.open(ModalEditPerguntaComponent, {
centered: true,
beforeDismiss: () => true,
size: 'md'
});
modalEditarSecao.componentInstance.item = item;
modalEditarSecao.result.then((data) => {
if(data){
this.workflow[0].secoes?.fill(data, undefined, undefined);
}
})
}
I'm pretty sure the problem is in the .fill() method, I think it's taking the value of 1 changed field and passing it on to all other items. however I don't know which method to use, I've tried many and I'm stuck on it for a few days, only the .fill "worked"