if(i==1){
this.resetScreens();
this.editJobScreen1 = true;
if(this.selectedLocations.length > 0){
this.locationService.getLocationByInput({
maxResultCount:16,
skipCount: 0
}).subscribe((ele)=>{
this.Regions = ele.items;
this.Regions.forEach((element) => {
this.HiringRegionMapComponent.list.push(element.id);
});
})
for(let i=0;i<this.selectedLocations.length;i++){
setTimeout(() => {
this.HiringRegionMapComponent?.addColor(this.selectedLocations[i].id);
}, 150);
}
}
}
Concern
An issue arises when attempting to color regions on an SVG map based on their ID. This problem occurs within a specific function triggered by the user pressing the back button. The use of setTimeOut() appears to resolve the issue, but occasionally leads to the function addColor() breaking (approximately 2 out of 20 times). A stable solution is sought to avoid these intermittent failures.
Anticipated Solution
Technologies:
- Angular (11.0.0)
- .NET Core (5.0)
A viable approach to address the predicament