I am trying to invoke a function on particular route after page loaded fully, like if user logged in and come to main page route first, and it loaded successfully a function will invoke/call by itself. constructor( private router: Router) { this.router.events.subscribe((event: Event) => { if (event instanceof NavigationEnd) { console.log(router.url); //function writes here } }); } I am calling this function on main.ts but when user trying to logged in this function invokes why ? Continue reading...