#Why my const array (allWidgetByAreaId ) is empty but the related filter works.

3 messages · Page 1 of 1 (latest)

formal plinth
#
        let messages: string[] = [];

        messages = messages.concat(this.getMessagesFromDeletingArea(area));

        this._translate.get('QuestionGroup_RemoveAreaConfirm',
            { thisCaption: area.caption[this.BlueContext.currentLanguage] }).subscribe(nextCaption => {
                this.dialogsService.confirm(nextCaption, messages)
                    .subscribe(confirmed => {
                        if (confirmed) {
                            this._areaService.removeArea(this.dashboardConfiguration, area, this.BlueContext.currentLanguage);
                            const index = this.areas.findIndex(a => a.id === area.id);
                            if (index > -1) {
                                this.areas.splice(index, 1);
                                //here
                            
                               
                                this.dashboardConfiguration.widgets.forEach(wAId => {
                                    const allWidgetByAreaId = wAId.widgets.filter(w => w.areaId === area.id);
                                    allWidgetByAreaId.forEach(w => {
                                        w.areaId = null;
                                        });
                                });
                                
                            }

                        }
                    });
            });
    }
#

Why my const array (allWidgetByAreaId ) is empty but the related filter works.

celest bough