angular - How to call a function on every route change in angular2 - Stack Overflow

PHOTO EMBED

Fri May 29 2020 16:43:52 GMT+0000 (Coordinated Universal Time)

Saved by @mohsin

    export class Mainapp {

    showBeforeLogin:any = true;
    showAfterLogin:any;
    constructor( public router: Router) {
     this.changeOfRoutes();

     }
     changeOfRoutes(){
      if(this.router.url === '/'){
         this.showAfterLogin = true;
      }
     }
}
content_copyCOPY

https://stackoverflow.com/questions/42453375/how-to-call-a-function-on-every-route-change-in-angular2