I am encountering an issue with my Angular 14 application. Upon loading, a modal popup is displayed at the route:
http://localhost:4200/select-role
this.router.navigateByUrl(AppConstants.SCREEN_ROUTES.HOME).then(success => this.loaderService.hide()).catch(err => this.loaderService.hide());
The popup contains a list of roles and radio buttons for user selection before proceeding to the landing page at:
http://localhost:4200/home
This 'home' route remains constant due to the configuration set with skipLocation
as false, making it the default route for 90% of the app. From the home page, there is a link (/steppers) that navigates to a steppers component within the same URL path http://localhost:4200/home
. However, when using the browser back button from the stepper component, it returns to the initial modal popup route
http://localhost:4200/select-role
.
How can I prevent this behavior so that clicking the browser back button from the stepper component directs the user back to the home component rather than reopening the modal popup?