I'm currently dealing with a problem related to duplicated paths. To illustrate the issue for testing purposes, I created a TestingComponent.
Here is the code snippet:
const routes: Routes = [
{
path: '',
redirectTo: 'testing',
pathMatch: 'full'
},
{
path: 'testing',
component: TestingComponent
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
@NgModule({
declarations: [
AppComponent,
TestingComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
],
providers: [DatePipe],
bootstrap: [AppComponent]
})
export class AppModule { }
In the app component html:
<router-outlet></router-outlet
The issue seems to be isolated to this particular project. When I create a new project, everything functions correctly. However, in this instance:
Upon entering localhost:4200, it redirects me to localhost:4200/testing (which is expected). But when I refresh the page, it then redirects me from localhost:4200/testing to localhost:4200/testing/testing (this behavior is unexpected and incorrect).
I have attempted reordering the routes but that did not resolve the issue.