Cloud Stack Ninja

I am working on an angular app which is embedded in an application I don't have access to. I am using a router to move from page to page once a pop-up modal has been OK'd (checkbox & button). I have to ensure that the modal has been destroyed before moving to the next page or the outer page causes problems. I have tried using *ngif="destroyModal". It works, but it's not happening in-time.

When I set the browser's debugger to stop the action on line with this.myRequestService.update... it seems to stop the action in such a way that my modal destroy works. If I use a debugger break-point on the next line (in the called-method) it doesn't work.

public goToPageTwo(): void {
    this.myObject = {};

    this.myRequestService.updateNextPg(this.myObject).subscribe((nextPageResponse) => {
        this.nextPageService.setData(nextPageResponse);
        this.router.navigateByUrl(NEXT_PAGE);
    }
}

I have tried several approaches with setTimeout(() => this.router.navigateByUrl(NEXT_PAGE), 2000) but this doesn't seem to have any effect. The only stop that allows the modal destroy to happen is one delivered by a debugger break-point.

I can't ask the user to do this :(



Read more here: https://stackoverflow.com/questions/64406951/how-is-browsers-debugger-different-from-angulars-settimeout

Content Attribution

This content was originally published by Scala Enthusiast at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: