There are different ways through which I know the current route in angular.
I would like to know the previous route. Say for example I'm 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.