how to detect a route change in angular

Detecting whenever a route change happens in your application can be very useful for a multitude of reasons.For instance you may wish to store form data in a cookie in case they accidentally clicked on something they didn’t mean to.

You can subscribe to router to detect changes(Angular7)

for example, Event) => {})