I want to route to a particular path when the back button will be clicked in the browser.
I was trying the following code snippet. But it changes the URL to the desired one for just a moment, and then routing to the previous actual URL.
constructor(location: PlatformLocation, private router: Router) {
location.onPopState(() => {
router.navigate(['/home']);
});
}