title: How to get previous route - route from where i came to current page
body: <p>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</p>
  <p>In the ngOnInit() method of this html &quot;http://localhost:4200/test/SampleNav/XYZ&quot; i want to get the previous url which is /ABC.</p>
  <p>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.</p>
  <p>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.</p>