2017-03-27 3 views
0

Mein app.routing Modul die folgenden RoutenAngular 2 Router ignoriert die leere Route

const routes: Routes = [ 
{ 
    path: 'path1', 
    loadChildren: 'app/modules/path1/path1.module#Path1Module', 
    canLoad: [AuthenticatedGuard] 
}, 
{ 
    path: 'path2', 
    loadChildren: 'app/modules/path2/path2.module#Path2Module', 
    canLoad: [AuthenticatedGuard] 
}, 
. 
. 
. 
{ 
path: 'login', 
loadChildren: 'app/modules/login/login.module#LoginModule', 
canLoad: [NotAuthenticatedGuard] 
}, 
{ path: '', redirectTo: '/defaultPath', pathMatch: 'full' }, 
{ path: '**', component: PageNotFoundComponent, pathMatch: 'full', canActivate: [AuthenticatedGuard] }]; 

Wenn die App Lasten enthält es mich direkt an path1 Modul nimmt, nicht die DefaultPath. Das Routing-Modul Pfad1 hat diese Konfiguration

const routes: Routes = [ 
{ 
    path: '', 
    component: Path1Component, 
    canActivate: [AuthenticatedGuard], 
    children: [ 
    { path: '', component: Path1ChildComponent } 
]}]; 

Wie kann ich das beheben?

Antwort

0

Ich hatte das Path1-Modul in das app.module importiert und dies verursachte irgendwie das Problem. Als ich es aus dem App entfernte, funktionierte das Modul-Routing wie erwartet.