I've already looked through this post to add {useHash: true}
but it did not fix my problem. I am able to navigate to the component but the URL never changes. It stays at localhost:4211 where it's hosted. I also am not able to manually type the URL like localhost:4211/atm
to route to that component. I believe there's a disconnect between the URL and router.
const routes: Routes = [
{
path: "",
component: HomeComponent,
pathMatch: "full"
},
{
path: "home",
component: HomeComponent,
},
{
path: "atm",
component: AtmFormPageComponent,
}
];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true, enableTracing: true })],
exports: [RouterModule]
})
export class AppRoutingModule { }
<div class="navbar-collapse" id="navbarColor01">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" routerLink="/home" >Home</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/atm" >atm</a>
</li>
I have the Router module imported and there are no errors in console or network.