I'm trying to navigate to a different route if the back button is pressed to a component.
this.page.on('navigatingTo', (args: NavigatedData) => {
if(args.isBackNavigation) {
this.router.navigateByUrl('/', { clearHistory: true });
}
});
Hi @jogboms,
I tested this scenario on my side and found that this problem has been caused due to fact that you are making the navigation too early, when the Page is not fully loaded.
Something that I could suggest is setting a timeout of 100 milliseconds, which will allow properly loading the page and making navigation successfully.
setTimeout(()=>{
this.routerExtensions.navigate(['/action-bar/title'], { clearHistory: true });
}, 100);
Thanks!.
Sorry for the delay in response.
This actually did the trick. Thanks again.
But instead of having to do this, it would have been better to achieve using Angular's implementation skipLocationChange so the route is not even added to the stack in the first place
Most helpful comment
Thanks!.
Sorry for the delay in response.
This actually did the trick. Thanks again.
But instead of having to do this, it would have been better to achieve using Angular's implementation
skipLocationChangeso the route is not even added to the stack in the first place