I want dropVolume get the value to use it in another method after calling my getAllDropsVolumePerDate(date) method. but every time I get dropVolume = 0
dropVolume = 0;
getAllDropsVolumePerDate(date: string) {
this.campaignService.getAllCampaigns().subscribe((res) => {
res.forEach((campaign) => {
campaign.drops.forEach((drop) => {
if (drop.dropDate === date) {
this.dropVolume = this.dropVolume +drop.dropVolume;
}
});
});
return this.dropVolume;
});
return this.dropVolume;
}