Answers for "angular how to run code every time you route"

0

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;
}
Posted by: Guest on March-05-2020

Code answers related to "angular how to run code every time you route"

Code answers related to "Javascript"

Browse Popular Code Answers by Language