I am trying to understand how the roiuting works on Angular. So here is my header and I want to go on different pages. my simple header
app.routing.ts:
export const appRoutes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'auth', component: AuthComponent },
{ path: 'about', component: AboutComponent }
]
export const ROUTING: ModuleWithProviders = RouterModule.forRoot(appRoutes);
app.module.ts
@NgModule({
declarations: [
...
],
imports: [
...
ROUTING
],
...
})
export class AppModule { }
app.component.html
<router-outlet></router-outlet>
home.component.html
<router-outlet></router-outlet>
Home <--> auth is OK
Home <--> about is OK
But auth <--> about is not working
I get this kind error:
Error: Cannot match any routes. URL Segment: 'about/auth'
As we can see the url is about/auth insead of authenter code here