execute a function whe the users change router angular code example
Example: angular how to run code every time you route
ngOnInit(){
this.router.events.subscribe(event =>{
if (event instanceof NavigationStart){
console.log(event.url)
this.routerChangeMethod(event.url);
}
})
}
routerChangeMethod(url){
this.title = url;
}