Disable initial navigation
By default,
RouterModule.forRoot
will trigger the initial navigation: the router will read the current URL and will navigate to it. We can disable this behavior to have more control.
@NgModule({ imports: [RouterModule.forRoot(ROUTES, {initialNavigation: false})], }) class MailModule { constructor(router: Router) { router.navigateByUrl("/fixedUrl"); } }