There are different ways through which I know the current route in angular. I would like to know the previous route. Say for example im in a tab http://localhost:4200/test/testNav/ABC Now, i click another tab that takes me to http://localhost:4200/test/SampleNav/XYZ
In the ngOnInit() method of this html "http://localhost:4200/test/SampleNav/XYZ" i want to get the previous url which is /ABC.
this.router.url, this.activatedRoute.snapshot all gives me the currenturl. Is there a way to get the previous url from the available angular components.
Basically when I come to XYZ page from ABC i should do something and when I come to XYZ from CBA i should do something else. Any inputs highly appreciated.