Let's say i'have this in my app.module.ts
@NgModule({
imports: [
BrowserModule,
HttpModule,
RouterModule.forRoot([
{path: 'home', component: HomeComponent},
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: '**', component: NotFoundComponent},
]),
UserModule
...
})
this leads in my opinion to this routing order:
{path: 'User', component: UserComponent},
{path: 'home', component: HomeComponent},
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: '**', component: NotFoundComponent}
Note that User is now before the others.
Now i am exporting the part RouterModule.ForRoot to another module called AppRoutingModule.
@NgModule({
imports: [
BrowserModule,
HttpModule,
AppRoutingModule, // newly created routing module
UserModule
...
})
this leads now to this in my opinion:
{path: 'home', component: HomeComponent},
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: '**', component: NotFoundComponent},
{path: 'User', component: UserComponent}
Note that User is now after the others.
So i have to put the AppRoutingModule below the UserModule. Why is it implemented like this?