In the below the screen shot , mentioned nested element as child array.
I wanted to remove child array element , I used below the script but it’s only remove first element.
removeChildWidget(parIndex:number,index:number){
if (parIndex >= 0) {
const widgetNumber = this.dashRightWidget[parIndex]?.widgetNumber;
const widgeDashtNumber = this.dashboardWidgets[parIndex]?.widgetNumber;
this.widgets.forEach((widget) => {
if (widget.widgetNumber == widgeDashtNumber) {
console.log("wid",widget.child[index])
if (index >= 0) widget.child.splice(index, 1)
console.log("wid",widget)
}
});
console.log('final output', this.dashboardWidgets)
}
}