@GünterZöchbauer also you can save it in localstorage but I not prefer it ) better to save in service and get this value from there
constructor(
private router: Router
) {
this.router.events
.subscribe((event) => {
if (event instanceof NavigationEnd) {
localStorage.setItem('previousUrl', event.url);
}
});
}